![]() |
Open Dialog when using BOOL OnInitDialog() function ?
BOOL OnInitDialog()
{ CListBox wndListBox; wndListBox.Attach (GetDlgItem (IDC_LIST1)->m_hWnd); wndListBox.AddString (_T ("One")); wndListBox.AddString (_T ("Two")); wndListBox.AddString (_T ("Three")); wndListBox.Detach (); return true; } When I use this code above in BOOL OnInitDialog() function of CDialog class, this code below can't execute. (IDC_LIST1 is a member of IDD_DLTEST1). Can you explain for me ? If I want to open IDD_DLTEST1 dialog, What do I have to do? void CallDialog() { Dlg d1(IDD_DLTEST1); d1.DoModal(); } |
Re: Open Dialog when using BOOL OnInitDialog() function ?
I could not get what you are asking.
|
Re: Open Dialog when using BOOL OnInitDialog() function ?
When i used this code in CDialog class:
Code:
BOOL OnInitDialog()Code:
void CallDialog() |
Re: Open Dialog when using BOOL OnInitDialog() function ?
Because you are not calling that function.
|
Re: Open Dialog when using BOOL OnInitDialog() function ?
This is my code. Help me
Code:
#include<afxwin.h> |
Re: Open Dialog when using BOOL OnInitDialog() function ?
We normally dont do this
ON_COMMAND(IDOK, CallDialog) but we override the OnOK but that should not be the cause of the problem. You are treating IDOK as a normal button and call dialog should be called. Is it that CallDialog is not getting called then follow this steps Make a dialog based MFC exe application Copy the following line in the message map ON_COMMAND(IDOK, CallDialog) Now add the CallDialog function in .h as follows afx_msg void CallDialog(); I think this should do the job Thanks Shabbir |
Re: Open Dialog when using BOOL OnInitDialog() function ?
I don't know much about .h, In the situation, Could you show content of .h file? thanks
|
Re: Open Dialog when using BOOL OnInitDialog() function ?
Opening the file on your system will show you the content.
|
| All times are GMT +5.5. The time now is 17:32. |