|
-
May 31st, 1999, 02:41 PM
#1
Accessing my main window control...
Hello to all !!!
I'm fairly new to MFC programming and I was wondering how can I reference my main window controls when i'm within a modal dialog box ???
Any help would be greatly appreciated 
Happy coding =:-)
-
May 31st, 1999, 02:48 PM
#2
Re: Accessing my main window control...
You can try using AfxGetMainWnd, this should return your mainframe window.
-Safai
-
June 1st, 1999, 08:24 AM
#3
Re: Accessing my main window control...
Hummm thanx for the answer but it didn't help very much... After getting the CWnd pointer to the main window how can refer to the controls in it ??? i.e I have a CListBox name lst...
thanx in advance 
-
June 1st, 1999, 08:33 AM
#4
Re: Accessing my main window control...
Well, you can cast your "CMainFrame" to the CWnd you got from AfxGetMainWnd. Then you can access the controls inside it, assuming you have member variables of those controls.
CMainFrame *pMainFrame = (CMainFrame*)AfxGetMainWnd();
pMainFrame->m_listbox.AddString("item1");
You can do this cast because you know for sure that the main window returned from AfxGetMainWnd is always of the type CMainFrame. (or whatever you set in CWinApp::InitInstance throught CWinApp::m_pMainWnd variable)
-Safai
-
June 1st, 1999, 09:06 AM
#5
Re: Accessing my main window control...
Thank you very much... It works wonderfully 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|