|
|
Was this of no help?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I have a com object in which there are different properties. When i get these values through it works well when property is returning long or some other integer but it crashes when property is returning bstr. Take a look at my code and guide me that what i did wrong.
VARIANT pvResult;
memset(&pvResult, 0, sizeof pvResult);
VariantInit(&pvResult);
DISPID dispID=this->pColl->getMemberID(index);
DISPPARAMS dispParamsNoArgs={NULL,NULL,0,0};
HRESULT hr=pDispatch->Invoke(dispID,IID_NULL,LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET,&dispParamsNoArgs,
&pvResult,NULL,&nArgErr);
Thanx in advance
Inam
|
|
|
|
|
hi..
i am trying to build setup program to my vc++ application
i follow the steps shows in an example i found it in code
project "Simple installshield tutorial" but when i go to the
Folder created by the setup program for the application i found file name:
Uninst.isu
so can any body see the mistake i made?
|
|
|
|
|
Hi,
I want to change the font style i.e. headers with bold and change some colors in the data tables (columns or rows) depending on the value. I dont know whether this can be done or not. Please guide me as i have not used excel before. I have to use MFC and i have excel 2003. Looking forward to a response. Thanks a lot in advance.
Regards,
Himanshu
|
|
|
|
|
Hi,
I want to change the font style i.e. headers with bold and change some colors in the data tables (columns or rows) depending on the value. I dont know whether this can be done or not. Please guide me as i have not used excel before. I have to use MFC and i have excel 2003. Looking forward to a response. Thanks a lot in advance.
Regards,
Himanshu
|
|
|
|
|
A Snippet of code from a junk app of mine :-
_Application oApp;
oApp.CreateDispatch("Excel.Application");
if (!oApp)
{
AfxMessageBox("Cannot start Excel");
return;
}
Workbooks oBooks = oApp.GetWorkbooks();
_Workbook oBook = oBooks.Add(vOpt);
Worksheets oSheets = oBook.GetWorksheets();
_Worksheet oSheet = oSheets.GetItem(COleVariant((short)1));
Range oRange;
long bMergeAcross = 0;
Styles styles = oBook.GetStyles();
Style s = styles.Add("Style with Center Text", vOpt);
s.SetVerticalAlignment(2);
s.SetHorizontalAlignment(3);
Font oFont = s.GetFont();
oFont.SetSize(COleVariant((long)FONT_SIZE_JUSTIFICATION));
VARIANT vt;
vt.vt = VT_DISPATCH;
vt.pdispVal = s.m_lpDispatch;
oRange.SetStyle(vt);
oRange=oSheet.GetRange(COleVariant("A1"),COleVariant("A2"));
oFont = oRange.GetFont();
oFont.SetBold(COleVariant((short)TRUE));
Hope this helps
By the way you will have to import the type library to use these classes
For more help
Click it[^]
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
I have an application with an edit box that receives input from a barcode scanner. When the scanner it set up to add the TAB key after the scanned code, everything works great since the KILL_FOCUS is activated.
But I'd like to also receive the scanned code followed by the ENTER key. Currently the ENTER key has the same effect as pressing the dialog box’s default pushbutton. It exits the dialog box after acting on the KILL_FOCUS message, which frustrates the application.
If I remove the default pushbutton IDOK from the dialog box, then the ENTER key won't exit the edit box and do KILL_FOCUS.
Any way to easily make the ENTER do exactly what TAB does?
Thanks!!
|
|
|
|
|
Create a PreTranslateMessage handler for you dialog/form view and have code such as
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_RETURN)
{
long nID = ::GetDlgCtrlID(pMsg->hwnd);
switch (nID)
{
case IDC_BTN_DOSOMETHING:
case IDOK:
break; //allow default behaviour - I assume you do want to respond to button presses
default:
NextDlgCtrl();
return true; //message has been handled
}
}
}
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Thanks a lot for you help, Monty. I am grateful.
Dave
|
|
|
|
|
As mentioned previously, use the pretranslate message but do this:
if (pMsg->message == WM_KEYDOWN && wParam == VK_RETURN)
{
CWnd *pWnd = GetFocus();
if (pWnd)
{
if (pWnd->IsKindOf(RUNTIME_CLASS(CEdit)))
{
pMsg->wParam = VK_TAB;
}
}
}
call the base class here
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|
|
Thanks a lot for you help. I really appreciate it.
Dave
|
|
|
|
|
I want to check the windows login user in my MFC application. How could i retrieve it.
|
|
|
|
|
|
I wish you can give me some suggestions. Thanks a lot!!!
|
|
|
|
|
Hi,
I'm having a problem with posting a user message. My property page can't receive the message. However the main frame can receive. Need your expert advise.
Thanks,
NadAzur
|
|
|
|
|
To whome are you posting the message to? Did you add the message map for the user event in the .cpp file.
Prakash,
India.
|
|
|
|
|
Hi,
Yes, I've added the necessary message map. Message is meant for a property page of my GUI (Single Document).
Regards,
NadAzur
|
|
|
|
|
Ok thats good, now only problem is to whome are you posting the message ?
Still Alive!!!
Thank you God.
|
|
|
|
|
OK, I'm posting the message to the GUI WndApp HWND where the property page belongs to. Is this OK?
|
|
|
|
|
Nope, not correct, if you have posted the message to the frame then it will recevie the message, you can do one thing you can use SendMessageToDescendants api to propogate the messages to its child. But take care that all the childs of the message will recive the message. But if you want to target only the property sheet then you need to post the message to the windows handle of the proprtysheet.
Still Alive!!!
Thank you God.
|
|
|
|
|
Thanks, I'll try it out.
|
|
|
|
|
Hi,
I am struggling to create a decent-looking toolbar using the Windows API with no MFC (it may well be easier with MFC if you know it, but I have yet to plough through my MFC books and I don't want to port the whole of my nearly-finished current project).
After struggling for a couple of days to get a 'flat' look (using TBSTYLE_FLAT) without having all the buttons become transparent, I discovered that to get the look I wanted, I needed to use Rebars. I used the code from MSDN (here) to create a test rebar, and it gave me the look I wanted - except that it is still screwy in another way (probably because MSDN assumes two other functions that it doesn't provide - CreateToolBar() and CreateComboBox()). Essentially, I want two rows of toolbars, so I figured that I would need to create two toolbars and two 'bands' in my rebar to hold them (ie. two calls of RB_INSERTBAND with the RBBS_BREAK style. I have successfully set up my test proggy so that it has two bands of the correct size, but the problem is that the toolbar buttons that should be on the second band aren't in the right place - they overlap the toolbar buttons on the first band (ie. both toolbars seem to have been created at window co-ords 0,0).
I can better explain what I mean by posting a picture:
Picture Here
The CPP file for this test proggy can be downloaded here - this is the only file of the project, so can be compiled to the test prog. It's messy because it's just a test program that I threw together to try and get rebars and toolbars working. CreateRebar() was ripped from MSDN, with only minor modifications. The problem might be there, or it might be in CreateToolBar() (which creates a toolbar with three text buttons) or CreateToolBarIcons() (which creates a toolbar with some standard Windows buttons). I've stared and stared, experimented, tested and generally poked around, but I just can't see what I'm doing wrong.
If anybody has a chance to scan these functions to see what my mistake is, or just make some suggestions as to what you might think the problem could be, I would really appreciate it. Obviously I don't expect anybody to debug my code - I only attach the CPP file because it is easier than posting three long functions here.
Many thanks to anyone who can help,
KB
|
|
|
|
|
P.S. Depending on what version of comctl32.lib you are using, you may have to change MIIM_STRING to MIIM_TYPE to get main.cpp to compile - or just comment out the whole of CreateMenu() as it has nothing to do with my toolbar problem anyway.
Any replies or help much appreciated!
Many thanks,
KB
|
|
|
|
|
Has anyone seen an implementation of an outlook bar control but that is horizontal, not vertical? An example of a vertical one is:
http://www.codeproject.com/cs/miscctrl/csoutlookbar.asp?target=outlook%7Chorizontal
I am looking for this control written in C++ not C# but would take either.
Thanks
Ralph
|
|
|
|