Hello,
it is necessary to create a callback function to handle the messages of an windows dialog box. The DialogBox() Function call requires a function pointer to this callback function.
If I don't use classes my sample code works fine but when I try to encapsulate my code in classes something goes wrong.
Here's a little example:
void GUIControl::init(HINSTANCE hInst)
{
InitCommonControls();
// Display the main dialog box.
DialogBox( hInst, MAKEINTRESOURCE(IDD_MOUSE), NULL, &GUIControl::dlgProc);
}
INT_PTR CALLBACK GUIControl::dlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
//handle GUI components
}
And the compiler says:
error C2664: 'DialogBoxParamA' : cannot convert parameter 4 from 'INT_PTR (__stdcall GUIControl::* )(HWND,UINT,WPARAM,LPARAM)' to 'DLGPROC'
Where is my failure? I mess around with the code but it won't work and I am no Windows programmer.
Many thanks in advance!
fisch