我写了一个依赖于一个DLL的对话框WIN32程序,主函数中与该问题有关的代码如下:
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
DialogBox(hInstance, (LPCTSTR)IDD_DIA_TEST, NULL, (DLGPROC)DiaTestProc); return TRUE;
}
我想让该程序的主线程接收来自它所依赖的DLL发送来的线程消息,这段编写代码我是这样编写的(你们是怎么写的?):
while (GetMessage(&msg, NULL, 0, 0))
{
switch(msg)
{
case xxx: ///xxx 为DLL发送来的消息
//the code handling the xxx
...
default:
if (!TranslateAccelerator(msg.hwnd,hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}在编写功能类似的非对话框WIN32程序时,我把这段代码放在主函数WinMain里,运行并成功。
现在的问题是:在对话框WIN32程序,应该把这断代码放在哪儿???
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
DialogBox(hInstance, (LPCTSTR)IDD_DIA_TEST, NULL, (DLGPROC)DiaTestProc); return TRUE;
}
我想让该程序的主线程接收来自它所依赖的DLL发送来的线程消息,这段编写代码我是这样编写的(你们是怎么写的?):
while (GetMessage(&msg, NULL, 0, 0))
{
switch(msg)
{
case xxx: ///xxx 为DLL发送来的消息
//the code handling the xxx
...
default:
if (!TranslateAccelerator(msg.hwnd,hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}在编写功能类似的非对话框WIN32程序时,我把这段代码放在主函数WinMain里,运行并成功。
现在的问题是:在对话框WIN32程序,应该把这断代码放在哪儿???
一个线程调用DialogBox(...)函数时,弹出来一个对话框,之后这个线程能不能再接收消息了???若能,怎么实现???拜托!!!