Thanks for those links, but I didn’t find any solution there. Nor the C/C++ naming conventions didn’t work. I think it is a problem with my compiler. I will get some Service Pack.
Just letting you know I know nothing about MFC or Win32 programming, but in your error, surely the DialogBox function is expecting a function pointer of the form int () (void), regardless of the calling convention? Since your function pointer is of the type int () (void *, unsigned int, unsigned int, long) it will never match, irrespective of the calling convention. Or is there some mystery about Windows programming that I don’t know about?
Thanks for that #define STRICT advice. You were right, it was wrongly defined. Now I don’t get those error messages anymore. But the program still does not work. i don’t know why. I even tried installing the newest service pack, changing resources, rewriting the program, but still nothing. The DialogBox function keeps on returning with -1.
judging by the original code, the thing that sticks out to me is the “MyDlg” argument to the DialogBox function - is that a reference to a resource id number?
here’s a short example of getting a dialog right:
// hInstance - winmain instance
// IDD_OPTIONS - resource id (make sure to use MAKEINTRESOURCE
// NULL - window owner (no parent)
// DlgProc - the function to call (cast to DLGPROC)
DialogBox(hInstance, MAKEINTRESOURCE(IDD_OPTIONS), NULL, (DLGPROC)DlgProc)
// end winmain
// dlgproc implentation
BOOL CALLBACK DlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch(msg)
{
case WM_INITDIALOG:
// do whatever
break;
case WM_COMMAND:
switch( LOWORD(wParam) )
{
case IDOK: // if you have IDOK
EndDialog(hDlg, 1) // will return one
break;
case IDCANCEL: // if you have IDCANCEL
EndDialog(hDlg, 0) // will return zero
break;
}
}
return 0;
}
if you start off with a stripped down dialog box (ie. with only an ok and cancel button) the dialog should pop up.
things that may make it screw it up (for example) are slider controls, they require additional Create"XControl" functions.