Figure 2   Task Manager Test App


 LRESULT WINAPI GetMsgProc(int code, WPARAM wParam, LPARAM lParam) {
    PMSG pmsg = (PMSG) lParam;
    if (pmsg->message == WM_RBUTTONDOWN) 
       Sleep(10000);
    return(0);
 }
 
 
 int WINAPI WinMain (HINSTANCE hinstExe, HINSTANCE hinstExePrev,
                     LPSTR pszCmdLine, int nCmdShow) {
 
    HHOOK hhook = SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, NULL,
                                   GetCurrentThreadId());
    MessageBox(NULL, "Click right mouse button to hang this thread",
               "MSJ Win32 Q & A App", MB_OK);
    UnhookWindowsHookEx(hhook);
 }