i'm trying to create a simple dll which has a .rc file with simple dialogbox and listbox within it. i have created the resource by the help of visual studio and by use of drag and drop the controls. i have exposed a function which is intern calls DialogBox() API.
I'm dynamically loading the dll from sample windows application and calling the exposed function. dialog box creation failing with error code 126
could any one help me why it is behaving like this !?
Here is the code:
INT_PTR CALLBACK WndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
{
InitCommonControls();
PopulateList(hwndDlg);
return TRUE;
}
case WM_COMMAND:
{
switch(wParam)
{
case IDOK:
SaveSelectedItem(hwndDlg);
EndDialog(hwndDlg,0);
return TRUE;
case IDCANCEL:
EndDialog(hwndDlg, 0);
return TRUE;
}
}
default:
DefWindowProc(hwndDlg, uMsg, wParam, lParam);
}
}
HINSTANCE gInstance;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
DialogBox(gInstance, MAKEINTRESOURCE(IDD_DIALOG), hwnd, WndProc);
return TRUE;
}