如何在不使用WndProc的情况下编写对话框消息循环? [英] How to program dialog message loop without using WndProc?
问题描述
大家好,
Hi all,
我想在InstallScript中编写一个简单的Win32样式的消息循环,这种语言不支持函数指针,所以我可能不会在那里使用WndProc。
I want to program a simple Win32 style message loop in InstallScript and this language that doesn't support function pointers, so I may not use WndProc there.
有没有办法在C ++中有类似于WaitOnDialog函数的东西?
Is there a way to have something analogous to WaitOnDialog function in C++?
这是一个常见的Win32对话框消息循环:
This is a common Win32 dialog message loop:
hWnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_MYDIALOG), 0, WndProc);
ShowWindow(hWnd,SW_SHOW);
UpdateWindow(hWnd);
while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
{
if (bRet == -1)
{
// Handle the error and possibly exit
}
else if (!IsWindow(hwndGoto) || !IsDialogMessage(hwndGoto, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
因此它在InstallScript中查找:
And thus it looks in InstallScript:
nResult = DefineDialog (szDialogName, hInstance, szDLLName,RES_DIALOG_ID, szDialog, 0,HWND_INSTALL, DLG_MSG_ALL|DLG_CENTERED);
bDone = FALSE;
repeat
nCmdValue = WaitOnDialog(szDialogName);
switch (nCmdValue)
case DLG_CLOSE:
Do (EXIT);
case DLG_ERR:
MessageBox ("Unable to display dialog. Setup canceled.", SEVERE);
abort;
case DLG_INIT:
hwndDlg = CmdGetHwndDlg("szDialogName");
case RES_PBUT_CANCEL:
Do (EXIT);
case RES_PBUT_NEXT:
bDone = TRUE;
case RES_PBUT_BACK:
bDone = TRUE;
endswitch;
until(bDone);
EndDialog (szDialogName);
ReleaseDialog (szDialogName);
推荐答案
markolog123写道:
markolog123 wrote:
我想在InstallScript中编写一个简单的Win32样式消息循环
I want to program a simple Win32 style message loop in InstallScript
您可能在致力于InstallShield支持的论坛中获得更好的运气:
You might have better luck in forums dedicated to InstallShield support:
http://community.flexerasoftware.com/
这篇关于如何在不使用WndProc的情况下编写对话框消息循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!