Hello,
I have created a DLL containing two functions that attempt to invoke dialog boxes. However, when executing the program that
calls the functions I see that the MessageBox, that's defined in one of the functions, is displayed, but neither of the dialog boxes open. It appears that I am not using the correct handle when calling these functions. Does anyone have a suggestion about how I can get the correct handle. Neither setting the handle to NULL, nor using GetModuleHandle() (to get the address of either the DLL or the Executable) works. The returned handle is always NULL. The two dialog boxes can be displayed through a different WIN32 application The two functions inside the DLL are:
Code:
// Modeless Dialog
extern "C"
{
TS104_API INT TS104_S1(VOID)
{
hWndParent = NULL;
hDlg = CreateDialog( GetModuleHandle(reinterpret_cast<LPCWSTR>("TS104.exe")),
MAKEINTRESOURCE(IDD_DIALOG2), hWndParent, (DLGPROC)GoTo1Proc ); 
if(hDlg != NULL)
{
 ShowWindow( hDlg, SW_SHOW );
}
else
{
 MessageBox( NULL, L"CreateDialog returned NULL", L"Warning!",
   MB_OK | MB_ICONINFORMATION );
}
return TRUE;
}
} 
// Modal Dialog
extern "C"
{
TS104_API INT TS104_S2( CHAR* Symbol, INT& Iarr, CONST INT Index )
{
hWndParent = NULL;
HINSTANCE hInstance = 0;
DialogBox( GetModuleHandle(reinterpret_cast<LPCWSTR>("TS104.exe")),
MAKEINTRESOURCE(IDD_DIALOG1), hWndParent, (DLGPROC)GoTo2Proc ); 
return TRUE;
}
}
Regards,
-Frank