ActiveX/modeless에서메세지받기
|
ActiveX/컨트롤설정 › ActiveX/컨트롤설정비교 › ActiveX/표시되었을 때 활성화 옵션 해제 › ActiveX/IObjectSafety인터페이스구현 › ActiveX/WebBrowserPointer얻기 › ActiveX/modeless에서메세지받기
// Handle to the Windows Message hook. It can be a global variable or a
// member variable in your CPropertySheet-derived class.
HHOOK hHook = NULL;
// Hook procedure for WH_GETMESSAGE hook type.
LRESULT CALLBACK GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam)
{
// Switch the module state for the correct handle to be used.
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
// If this is a keystrokes message, translate it in controls'
// PreTranslateMessage().
LPMSG lpMsg = (LPMSG) lParam;
if( (nCode >= 0) &&
PM_REMOVE == wParam &&
(lpMsg->message >= WM_KEYFIRST && lpMsg->message <= WM_KEYLAST) &&
AfxGetApp()->PreTranslateMessage((LPMSG)lParam) )
{
// The value returned from this hookproc is ignored, and it cannot
// be used to tell Windows the message has been handled. To avoid
// further processing, convert the message to WM_NULL before
// returning.
lpMsg->message = WM_NULL;
lpMsg->lParam = 0L;
lpMsg->wParam = 0;
}
// Passes the hook information to the next hook procedure in
// the current hook chain.
return ::CallNextHookEx(hHook, nCode, wParam, lParam);
}
// Declare and define the following two functions:
BOOL CModelessPropertySheet::OnInitDialog()
{
CPropertySheet::OnInitDialog();
// Install the WH_GETMESSAGE hook function.
hHook = ::SetWindowsHookEx(
WH_GETMESSAGE,
GetMessageProc,
AfxGetInstanceHandle(),
GetCurrentThreadId());
ASSERT (hHook);
return TRUE; // Return TRUE unless you set the focus to a control.
// EXCEPTION: OCX Property Pages should return FALSE.
}
void CModelessPropertySheet::OnClose()
{
// Uninstall the WH_GETMESSAGE hook function.
VERIFY (::UnhookWindowsHookEx (hHook));
CPropertySheet::OnClose();
}
Steps to Reproduce the Problem
|
- 전 이런 놈입니다.
격언> 쓰러질지언정 무릎은 꿇지 않는다. (박지성)
Recent Changes Echoes Of War(The... @ 2012-05-18 [03:44 pm] by windlesszone Diablo3 @ 2012-05-15 [04:49 pm] by windlesszone Diablo3/story/wizard @ 2012-05-15 [04:48 pm] by windlesszone 4 changes Diablo3/story/wit... @ 2012-05-15 [04:16 pm] by windlesszone Diablo3/story/monk @ 2012-05-15 [04:14 pm] by windlesszone
|
