Advertisement

Newbie in need

Started by December 18, 2000 06:16 AM
6 comments, last by Maxxes 24 years ago
I''m trying to learn programming for windows, but I can''t get a dialog box up. While compiling I get the following errormessage: ''DialogBoxParamA'': cannot convert parameter 4 from ''int(void *,unsigned int,unsigned int,long)'' to ''int(_stdcall *)(void)'' the line in question reads: DialogBox (hInstance, MAKEINTRESOURCE(IDD_NIEUW), hwnd, NieuwDlgProc); I''m using VC++ can anyone help?
Hi,
I Assume that the function NieuwDlgProc is defined proparly this means that you only need to cast it for the compiler:
DialogBox (hInstance, MAKEINTRESOURCE(IDD_NIEUW), hwnd, (DLGPROC)NieuwDlgProc); DLGPROC ==> I''m not sure that this is the definition because i don''t have my msdn on my laptop but I think you get the idea
Advertisement
Thanks a lot! That worked!

Still i'm missing something, in sample programs (DLGPROC) isn't necessary, why is it in my program?

anyway i can now continue, thanx again

Edited by - Maxxes on December 18, 2000 9:10:42 AM
It may be that they are defined as some differnt kind of function type...

- Sleepwalker
- Sleepwalker
No the names are unique.
it may be because the sample programs are .c files, and you''re probably compiling .cpp files, C++ has stricter type-checking
Advertisement
How are you declaring NieuwDlgProc?

It should be:

BOOL CALLBACK NieuwDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );

You don''t want to type cast it in your DialogBox function, because if you change calling conventions the stack may not get cleaned up...
That''s exactly how I declared ''NieuwDlgProg'' anonymous, no problems there, I guess rational_rose is right about the stricter type-checking of C++.

This topic is closed to new replies.

Advertisement