类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
请问怎样在没有对话框的应用程序下响应WM_TIMER消息?
网友回答:
建个隐藏的窗口
修改窗口属性,使其为隐藏
HWND CreateWindow( LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam
);
dwStyle中不要包含WS_VISIBLE。
或者在CreateWindow之后,调用:
BOOL ShowWindow( HWND hWnd, int nCmdShow );
其中nCmdShow = SW_HIDE;
// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
你的程序应该是win32程序吧.如果是字符界面的话,你加入上面这段,然后就可以响应了