|
Menu commands are sent directly to the window - you can't catch them in your message loop. It seems that you'll have to subclass the console window.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi!
In my main frame, I have a list control. There are severals possibilities to add a item in this list control. One of them is from another dialog, this dialog get the informations of any file and send them to the list control.
void CSendFile::m_SendFilePush(void) //Dialog to send a file
{
CListCtrl *CCtrList;
.............
//Informations of the file
v_CFileInfo.itv_sPathName = v_FilePathName;
v_CFileInfo.itv_sFileName = v_FileName;
v_CFileInfo.itv_sExtName = v_ExtFile;
//The code to add item in my lsit control
CCompadApp *pApp = (CCompadApp *)AfxGetApp();
//CCompadDlg has the list control
CCompadDlg *pDlg = (CCompadDlg *)pApp->m_pMainWnd;
CCtrList = (CListCtrl *)GetDlgItem(IDC_LIST_CONTROL);
LVITEM v_ListCtrlItem;
CString v_StringItem;
CString v_FileType;
// Insert the item
v_ListCtrlItem.mask = LVIF_TEXT;
v_StringItem.Format(v_FileName, 0);
v_ListCtrlItem.iItem = 0;
v_ListCtrlItem.iSubItem = 0;
v_ListCtrlItem.pszText = (LPTSTR)(LPCTSTR)(v_StringItem);
v_ListCtrlItem.iImage = NULL;
CCtrList->InsertItem(&v_ListCtrlItem);
EndDialog(v_SendFileDlgID);
}
This compile but there aren't any added item in the list control from CSendFile Dialog.
What is the problem?
Thanks
PS. Excuse me for this english
Endymion
|
|
|
|
|
Here is the problem....
GetDlgItem(IDC_LIST_CONTROL);
You need to get a reference of The listctrl but in ther other Dialog.
You need to do this.
CCTrlList = (*CListCtrl)pDlg.GetDlgItem(IDC_LIST_CONTROL); //Where pDlg is the class of the other Dialog.
The compiler don't return errors because the IDC_LIST_CONTROL constant exist in the resurce.h file.
Cheers!!!
Carlos Antollini.
|
|
|
|
|
I'm getting a runtime error that reads:
"The value of ESP was not properly saved across a function call. This is usually the result of calling a function declared with one calling convention with a function pointed declared with a different calling convention."
What I'm trying to do is use a CToolbar-derived class to respond to events and access the active document via the toolbar's parent, CMainFrame.
//In the Toolbar-derived class
CMainFrame *mf = (CMainFrame*) GetParent();
CTestDoc *pDoc = (CTestDoc*)(mf->GetActiveDocument());
The error seems to say I can't use a pointer to the MainFrame to call the GetActiveDocument function? Any suggestions would be appreciated
Jake
|
|
|
|
|
i always find that a thorough Rebuild-All will fix this. i think it's a stack corruption issue.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
CMainFrame *mf = (CMainFrame*) GetParent();
You're getting in trouble with the cast. The toolbar's parent window isn't the main frame, it's the CDockBar that the toolbar lives in. Call AfxGetMainWnd() instead to get a pointer to the main frame.
--Mike--
http://home.inreach.com/mdunn/
Push the button, Frank.
|
|
|
|
|
--Mike-- http://home.inreach.com/mdunn/ Push the button, Frank.
Exactly what button am I supposed to push???
|
|
|
|
|
This is question which is rather specific to WinCE...
I can't figure out how to use the CCeCommandBar class to add a button to the command bar represented by the class. This class has methods for inserting menus, combo boxes, and separators, but, for some reason, no InsertButton method.
I have tried using the nonMFC function CommandBar_AddButton, taking as the first parameter the HWND which is the m_hWnd member of the CCeCommandBar. For some reason I am also having trouble getting this to work.
Your help much appreciated, I'm afraid I'm rather a novice at all this.
Matthew Fleming
|
|
|
|
|
I have a function that takes as an argument the address of a function
to be used as a CALLBACK
HRESULT CALLBACK ACallBackFunction(PVOID var);
if i try to make this functiona a method of a class it will not work
and i get the following compile error.
cannot convert from 'long (void *)' to 'long (__stdcall *const )(void *)'
so how can I make a class method be used as a CALLBACK (WINAPI,FAR PASCAL)
|
|
|
|
|
|
Or see Lohman's brand new article on this site.
|
|
|
|
|
How can I know how my propertySheet terminated ? with OK or with CANCLE ?
I need to save the data of pages if it terminated with OK.
|
|
|
|
|
|
Thank
|
|
|
|
|
Hi,
Although I asked this question before, but I can't get it,
I like to know how can I get a pointer to the first document in MDI.
the pointer has to have access to the document's data.
Thanks
Ehsan
Ehsan Behboudi
|
|
|
|
|
What do you mean by "first document"? The one that was created first or the currently active one?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
In my MDI application, I'm able to open several Bitmaps, each in a seperate document.
lets say that i opened the second bitmap. and I'd like to have a pointer to the data of the document opened first(fist document).
how do I do that?
|
|
|
|
|
You can iterate over currently open document using CDocTemplate::GetFirstDocPosition/GetNextDoc. Use CWinApp::GetFirstDocTemplatePosition/GetNextDocTemplate to get access to registered document templates, or store doctemplate pointer as a member of your app class in InitInstance.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Greetings Programs,
Ran into a bit of a conundrum and I need a little help. The following code is from an app I am writing to access and enumerate WMI objects.
if((hRes = pObjectInstance->Get(csArray.GetAt(iCounter).AllocSysString(), 0L, &varString, NULL, NULL)) == S_OK)
{
//Blah
}
Now, ordinarily this code return a Variant as one would expect. However, in some cases the data returned is supposed to be an array (Such as the Win32_NetworkAdapterConfiguration\IPAddresses object).
I pass all data returned through a switch for processing and the data that is supposed to be returned as an array definately triggers on case VT_BSTR|VT_ARRAY and not VT_BSTR.
But I can't figure out how to access that array. Can someone lend a hand please?
Many thanks,
Rhoam
|
|
|
|
|
What value returns the VT element of the variant????
Carlos Antollini.
|
|
|
|
|
Use the following functions:
SafeArrayGetLBound() and SafeArrayGetUBound() to check the bound of your array and
SafeArrayGetElement() to read each BSTR string. Since the data in not being passed
by reference: VT_BYREF (a pointer). I guess you will have to call SysFreeString().
|
|
|
|
|
I need use textBox(read only) with spin.But I have problem:
If I set the range of spin with max number bigger than 999
In run time I gets a MessageBox of error "please enter a integer"
what can I do if I need to work with bigger numbers(as 10000-100000) ???
Please help me.
|
|
|
|
|
|
Generally, you get an error like that because you have set a limitation on the number associated with the edit control. For instance, if you code the following in your DoDataExchange() function:
DDV_MinMaxInt( pDX /*CDataExchange Object*/,
m_iNumber /*member of this class*/,
50, /*minimum accepted value*/
999 /*maximum accepted value*/ );
You will get an error when your dialog is initialized if the data m_iNumber is not in the valid range.
|
|
|
|
|
I have seen search in MFC header file I have found to be call something like "Forward Class Declaration".
Here is an example of what I found... (Class Names Changed)
class CANormalCPPClass
{
class CAForwardableClassDeclaration; /*forward declaration of CAForwardableClassDeclaration*/
...
}
What going on in a class like this and how usefull is Forward Class Declaration?
|
|
|
|