Hi all,
I have 2 classes Class1 and mainWindow. mainWindow has a function with the following signature:
Code:
mainWindow::DetectorProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
Now Class1 has the WinMain entry point and it also has the WinProc procedure to deal with the messages. Now what I want to do is create a dialogue from a resource file which I have created and to tell it to use the DetectorProc function in the other class. I tried this but with no luck, this is in the WinProc procedure of Class1.
Code:
case WM_CREATE:
{
mainWindow = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDC_GUIMAIN),
hwnd, mainWindow::DetectorProc);
if(mainWindow != NULL)
{
ShowWindow(mainWindow, SW_SHOW);
}
}
break;
However I get the following error message:
Code:
error C2664: 'CreateDialogParamA' : cannot convert parameter 4 from 'int (__stdcall mainWindow::*)(struct HWND__ *,unsigned in
t,unsigned int,long)' to 'int (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)'
I tried doin the following but with no luck (it compiled fine but it seems tha the DetectorProc procedure wasnt getting the messages)
Code:
case WM_CREATE:
{
typedef int (CALLBACK *DetectorProc)(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
DetectorProc dp;
dp = (DetectorProc)::GetProcAddress((HINSTANCE)mainWindow, "DetectorProc");
mainWindow = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDC_GUIMAIN),
hwnd, dp);
if(mainWindow != NULL)
{
ShowWindow(mainWindow, SW_SHOW);
}
}
break;
Hopefully you can understand what im trying to do and can show me the right path as im pretty sure im not suppossed to use GetProcAddress as I have done above.
Thanks for any help