cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mirik222
Level 5

Using Win32 Controls and Message loops in IS

Hi all.
I try to overcome IS limitations regarding dialog messages and custom controls and I stucked at the very beginning.

prototype HWND User32.CreateDialogParamA(POINTER,LPSTR,HWND,POINTER,NUMBER);
prototype BOOL User32.GetMessage(MSG POINTER,HWND,NUMBER,NUMBER);

MSG msg;
STRING szDlgID = "12006";
LPSTR lpstrDlgID = &szDlgID;
HWND hwndDlg;

hwndDlg= CreateDialogParamA(NULL, lpstrDlgID, NULL, NULL, 0);
if(!IsWindow(hwndButton)) then
return FALSE;
endif;

ShowWindow(hwndDlg,SW_SHOW);
UpdateWindow();

while (!bDone)
//GetMessage(&msg,NULL,0,0);
PeekMessageA(&msg,NULL,0,0,PM_REMOVE|PM_NOYIELD);
...
endwhile;

The dialog is not created.

May be somebody has positive experience in this area?
Used EzDefineDialog with external DLL?
Created custom controls in IS?
Defined dialogs and processed message loop in Win32/C style?
Defined function pointers in IS?
Labels (1)
0 Kudos
(2) Replies
mirik222
Level 5

I found out that it can be achieved by DefineDialog + DLG_MSG_ALL.
It supposed to pass all windows messages but the problem is that WaitOnDialog still filters all non "OnClick" messages.
I was able to see only WM_LBUTTONDOWN.
0 Kudos
mirik222
Level 5

Hi all.
After long time of R&D I reached this point in my fight with InstallShield monster:
szDllName = "C:\\Visual Studio 2008 Projects\\testdll\\Debug\\testdll.dll";
UseDLL(szDllName);
hMod = GetModuleHandle(szDllName);
if(hMod = NULL) then
MessageBox("hMod",MB_OK);
abort;
endif;

hFunc = GetProcAddress(hMod,"DlgProc");
if(hFunc = NULL) then
MessageBox("hFunc",MB_OK);
abort;
endif;


if(DefineDialog( szDlg, 0, "", SD_NDLG_WELCOME,"",0,HWND_INSTALL,DLG_MSG_ALL|DLG_CENTERED ) = DLG_ERR) then
return -1;
endif;

hwndDlg = FindWindow("","dialog - InstallShield Wizard");
if(hwndDlg = NULL) then
MessageBox("hwndDlg = NULL",MB_OK);
abort;
endif;

vRes = SetWindowLong(hwndDlg,DWL_DLGPROC,hFunc);
if(vRes = 0) then
MessageBox("vRes = 0",MB_OK);
abort;
endif;

ShowWindow(hwndDlg, SW_SHOW);
UpdateWindow(hwndDlg);

vRes = GetMessage(&msg, NULL, 0, 0);
while (vRes != 0)
if (vRes == -1) then
MessageBox("GetMessage=-1",MB_OK);
elseif (!IsWindow(hwndDlg) || !IsDialogMessage(hwndDlg, &msg)) then
TranslateMessage(&msg);
DispatchMessage(&msg);
endif;
vRes = GetMessage(&msg, NULL, 0, 0);
endwhile;

FreeLibrary(hMod);


This code is for testdll.dll with windows message loop:
extern "C" __declspec(dllexport) INT_PTR DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
OutputDebugString(L"WM_INITDIALOG");
return (INT_PTR)TRUE;

case WM_COMMAND:
OutputDebugString(L"WM_COMMAND");
if (LOWORD(wParam) == 9 || LOWORD(wParam) == 1)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}


My goal is to catch all windows messages in IS message loop.
Right now, for example, for ListView it can catch some of the ListView messages when that control is focused (mouse is over it).

The above code works on C++ but doesn't work on IS.
Does someone have any clue?
0 Kudos