Click here to Skip to main content
15,921,622 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralSerialize Pin
mr200314-May-01 8:47
mr200314-May-01 8:47 
GeneralRe: Serialize Pin
Christian Graus14-May-01 12:52
protectorChristian Graus14-May-01 12:52 
GeneralRe: Serialize Pin
14-May-01 23:38
suss14-May-01 23:38 
GeneralWindow extensions in GDI Pin
14-May-01 6:36
suss14-May-01 6:36 
GeneralFilling a combo box from outside its dialog Pin
Wayne Janaway14-May-01 6:27
Wayne Janaway14-May-01 6:27 
GeneralRe: Filling a combo box from outside its dialog Pin
David Fleming14-May-01 12:07
David Fleming14-May-01 12:07 
GeneralRe: The easiest way is ... Pin
Masaaki Onishi14-May-01 17:58
Masaaki Onishi14-May-01 17:58 
GeneralRe: Filling a combo box from outside its dialog Pin
#realJSOP15-May-01 8:23
professional#realJSOP15-May-01 8:23 
In the app class header file, after the app class definition, add the folowing line:

extern CMyApp theApp;


Add these declarations to your app class:

private:
    CMainFrame* m_pMainFrame;
public:
    CMainFrame* GetMainFramePtr() { return m_pMainFrame);


In the OnInitInstance function of your app class, do this AFTER the main window is created:

m_pMainFrame = pMainFrame;


In the CMainFrame class, put a function that accepts a CComboBox* like so:

int CMainFrame::FillComboBox(CComboBox* pCombo)
{
    // fill the combo box
    // and return the number of things you put in it
    return pCombo->GetCount();
}


From within the OnInitDialog() function in the dialog box class, call your function like so:

theApp.GetMainFrame()->FillComboBox(&m_ctrlComboBox);


I'm assuming that your dialog box class already has #include "MyApp.h" in it. Smile | :)
Questioncall strcpy??????????? Pin
14-May-01 4:42
suss14-May-01 4:42 
AnswerRe: call strcpy??????????? Pin
XKent14-May-01 9:02
XKent14-May-01 9:02 
AnswerRe: call strcpy??????????? Pin
David Fleming14-May-01 14:05
David Fleming14-May-01 14:05 
GeneralRe: call strcpy??????????? Pin
14-May-01 15:42
suss14-May-01 15:42 
GeneralRe: call strcpy??????????? Pin
15-May-01 3:56
suss15-May-01 3:56 
AnswerRe: call strcpy??????????? Pin
15-May-01 4:18
suss15-May-01 4:18 
AnswerRe: call strcpy??????????? Pin
#realJSOP16-May-01 0:56
professional#realJSOP16-May-01 0:56 
GeneralStopping an application... Pin
Roger14-May-01 2:34
Roger14-May-01 2:34 
GeneralRe: Stopping an application... Pin
Tomasz Sowinski14-May-01 2:42
Tomasz Sowinski14-May-01 2:42 
GeneralRe: Stopping an application... Pin
Roger14-May-01 2:53
Roger14-May-01 2:53 
GeneralRe: Stopping an application... Pin
Tomasz Sowinski14-May-01 3:03
Tomasz Sowinski14-May-01 3:03 
GeneralRe: Stopping an application... Pin
Roger14-May-01 6:45
Roger14-May-01 6:45 
QuestionCFileDialog converting??? Pin
14-May-01 0:22
suss14-May-01 0:22 
AnswerRe: CFileDialog converting??? Pin
Tomasz Sowinski14-May-01 0:34
Tomasz Sowinski14-May-01 0:34 
GeneralRe: CFileDialog converting??? Pin
14-May-01 0:39
suss14-May-01 0:39 
GeneralRe: CFileDialog converting??? Pin
Tomasz Sowinski14-May-01 1:21
Tomasz Sowinski14-May-01 1:21 
GeneralRe: CFileDialog converting??? Pin
14-May-01 2:40
suss14-May-01 2:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.