Advertisement

Dialog Boxes

Started by December 28, 2000 12:34 PM
2 comments, last by Gomacadeshez 24 years ago
I want to create a dialog box with
  
int DialogBox(
HINSTANCE hInstance,  // handle to application instance

LPCTSTR lpTemplate,   // identifies dialog box template

HWND hWndParent,      // handle to owner window

DLGPROC lpDialogFunc  // pointer to dialog box procedure

);				
[/source]

so I do this

[source]  


case ID_HELP_ABOUT:
		{
		DialogBox(NULL,"ABOUT",main_window_handle,NULL /*<-I know this should not be null*/);
               }

[/source]

At the moment when the dialog box is painted it is painted in the main client area and then the program freezes.

How do you create a pointer to the 
[source]
BOOL CALLBACK DialogProc(
  HWND hwndDlg,  // handle to dialog box

  UINT uMsg,     // message

  WPARAM wParam, // first message parameter

  LPARAM lParam  // second message parameter

)
  
function?? It always tells me that the pointer type and function type are differnt.
Try the following:
Make an varible DLGPROC lpDlgProc, try global at first.
Then in your WndProc function(the one that sets up pointers, not the one with the cases), use the MakeProcInstance (I forget the exact parameters, but they should be pretty usual), and assign that value to your lpDlgProc (probably need to typecast).
This value can now be passed with every call to DialogBox().

If you have problems with this, I can get my example code and try to be a little more clear.
Hope this helps,
Nick
·†§ Nick §† ·
Advertisement
MakeProcInstance is an obsolete holdover from 16-bit Windows. If you''re doing 32-bit stuff you don''t need it.

For the lpDialogFunc argument just give the name of your dialog function. In your case it would be "DialogBox(NULL,"ABOUT",main_window_handle,DialogProc)".

-Mike
It worked! thanks

This topic is closed to new replies.

Advertisement