Click here to Skip to main content
15,912,756 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Win 32 error Pin
jetournier1-Apr-04 19:35
jetournier1-Apr-04 19:35 
GeneralSetCursor Pin
ns31-Mar-04 2:46
ns31-Mar-04 2:46 
GeneralRe: SetCursor Pin
Antti Keskinen31-Mar-04 3:23
Antti Keskinen31-Mar-04 3:23 
GeneralRe: SetCursor Pin
ns31-Mar-04 3:40
ns31-Mar-04 3:40 
GeneralRe: SetCursor Pin
ns31-Mar-04 4:05
ns31-Mar-04 4:05 
GeneralRe: SetCursor Pin
Antti Keskinen31-Mar-04 4:49
Antti Keskinen31-Mar-04 4:49 
GeneralRe: SetCursor Pin
ns31-Mar-04 8:51
ns31-Mar-04 8:51 
GeneralProblems with GetMsgProc & WH_GETMESSAGE using SetWindowsHookEx Pin
triptiarora31-Mar-04 1:57
triptiarora31-Mar-04 1:57 
I am trying to hook a 3rd Party Window.

Just a little background:
After I get the handle of this window, I use the 'GetWindowThreadProcessId' to get the Thread Id of the window.
Code:
dwThreadId = ::GetWindowThreadProcessId(hwndTskMgr, NULL);
-----------------------------------------------------------------------------

Then I am calling the 'SetWindowsHookEx' function.
Code:
g_hhook = ::SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, g_hinstDll, dwThreadId);
-----------------------------------------------------------------------------

In function 'GetMsgProc', I am trying to monitor the 'SB_SETTEXT' or 'WM_SETTEXT' message to be able to detect when the ‘3rd Party Window’ sets the text of the status bar.
Code:
LRESULT CALLBACK GetMsgProc(int code, WPARAM wParam, LPARAM lParam)
{
char msg5[255];
wsprintf(msg5, "Inside GetMsgProc & code = %d",code);
::OutputDebugString(msg5); // Just a test

if (code < 0)
{
return CallNextHookEx(g_hhook, code, wParam, lParam);
}
if ((code == HC_ACTION) && (wParam == PM_REMOVE))
{
::OutputDebugString("In code is HC"); // Just a test

MSG *pMsg = (MSG*)lParam;
if(pMsg->message == WM_SETTEXT)
::OutputDebugString("WM_SETTEXT was found\n");
else
::OutputDebugString("WM_SETTEXT was not found\n");
}

return CallNextHookEx(g_hhook, code, wParam, lParam);
}
-----------------------------------------------------------------------------

Problem:
In 'SetWindowsHookEx' I am using 'WH_GETMESSAGE' type of hook procedure, which would give a call to 'GetMsgProc'.
But the CALLBACK GetMsgProc function is not getting called. And some time the GetMsgProc function gets called but my whole system gets stuck up and hangs. And then I need to restart the system.

I have gone through a lot of code in 'CodeGuru.com' as well as in 'CodeProject.com', and have tried many combinations but still am not able to hook the various messages of the Task Manager. I am not able to figure out where I am going wrong.

Any help in this regard would be really appreciated.
GeneralMenu Bar Color Pin
olis31-Mar-04 0:57
olis31-Mar-04 0:57 
GeneralRe: Menu Bar Color Pin
ohadp31-Mar-04 2:13
ohadp31-Mar-04 2:13 
GeneralFile Property Pin
hb.sapto nugroho31-Mar-04 0:21
hb.sapto nugroho31-Mar-04 0:21 
GeneralRe: File Property Pin
David Crow31-Mar-04 2:07
David Crow31-Mar-04 2:07 
GeneralRe: File Property Pin
hb.sapto nugroho31-Mar-04 3:07
hb.sapto nugroho31-Mar-04 3:07 
GeneralRe: File Property Pin
David Crow31-Mar-04 3:46
David Crow31-Mar-04 3:46 
GeneralRe: File Property Pin
hb.sapto nugroho31-Mar-04 15:52
hb.sapto nugroho31-Mar-04 15:52 
GeneralRe: File Property Pin
David Crow1-Apr-04 3:12
David Crow1-Apr-04 3:12 
QuestionHow to take screenshots Pin
Anonymous30-Mar-04 23:24
Anonymous30-Mar-04 23:24 
AnswerRe: How to take screenshots Pin
Uwe Keim31-Mar-04 1:26
sitebuilderUwe Keim31-Mar-04 1:26 
GeneralRe: How to take screenshots Pin
Alexander M.,31-Mar-04 2:01
Alexander M.,31-Mar-04 2:01 
GeneralRe: How to take screenshots Pin
Prakash Nadar31-Mar-04 5:06
Prakash Nadar31-Mar-04 5:06 
GeneralRe: How to take screenshots Pin
Anonymous31-Mar-04 7:56
Anonymous31-Mar-04 7:56 
AnswerRe: How to take screenshots Pin
David Crow31-Mar-04 2:11
David Crow31-Mar-04 2:11 
GeneralRe: How to take screenshots Pin
Anonymous31-Mar-04 7:58
Anonymous31-Mar-04 7:58 
GeneralConvert C++ DLL to VB.net Help Pin
nelsonbd30-Mar-04 22:53
nelsonbd30-Mar-04 22:53 
GeneralRe: Convert C++ DLL to VB.net Help Pin
Antony M Kancidrowski31-Mar-04 0:38
Antony M Kancidrowski31-Mar-04 0:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.