现在写了一下程序,
BOOL CXinDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow()); // center to the hpc screen
// TODO: Add extra initialization here
RETAILMSG(1,(TEXT("DialogProc WM_INITDIALOG\r\n")));
InitializeTests();//初始化I/O
SetKBHook();
::SetFocus(NULL);//获取焦点
//以下语句的思路是不是有点问题?
MSG msg;
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if (::PeekMessage(&msg, m_hWnd, WM_KEYFIRST,WM_KEYLAST, PM_REMOVE))
{
if (msg.message == WM_KEYDOWN )
{DialogProc(
m_hWnd,
msg.message ,
msg.wParam, //这个函数应该怎么样传入?
msg.lParam ); //这个函数应该怎么样传入?
}
此程序编译没有错误,只是启动后界面转入后台运行,请问是不是消息机制设置的不对,怎么改正?谢谢!
} |