Hooks. Dll with the scroll bar to view information about WH_MSGFILTER questions

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="color:#333333; font-family:arial,sans-serif; font-size:16px; background-color:#f5f5f5 <span>I <span>want to use <span>the technology <span>linking <span>the <span>WM_PSD_ENVSTAMPRECT <span>scroll
bar <span>to check<span>the <span>information <span>lparam.

<img src="http://social.microsoft.com/Forums/getfile/24035/" alt="
<span style="color:#333333; font-family:arial,sans-serif; font-size:16px; background-color:#f5f5f5 <span>Here is what I <span>use <span>SPY + + <span>to monitor <span>the information <span>that <span>window<span>.
<span style="color:#333333; font-family:arial,sans-serif; font-size:16px; background-color:#f5f5f5 <span><00059> 000C094A S WM_PSD_ENVSTAMPRECT hDC: 00000001 lprcEnvStamp: 00000004 [wParam: 00000001 lParam: 00000004] <br/>
<span><00060> 000C094A S WM_PAINT hdc: 00000000 [wParam: 00000000 lParam: 00000000]<br/>
<span><00061> 000C094A S WM_PRINTCLIENT hdc: FB013AA6 uFlags: PRF_CLIENT | PRF_CHILDREN [wParam: FB013AA6 lParam: 00000014]<br/>
<span><00062> 000C094A S message: 0x2138 [<span>User-defined<span>: WM_USER +7480] wParam: 23014941 lParam: 000C094A<br/>
<span><00063> 000C094A R message: 0x2138 [<span>User-defined<span>: WM_USER +7480] lResult: 00000010<br/>
<span><00064> 000C094A S message: 0x204E [<span>User-defined<span>: WM_USER +7246] wParam: 00000000 lParam: 0012E75C<br/>
<span><00065> 000C094A R message: 0x204E [<span>User-defined<span>: WM_USER +7246] lResult: 00000000<br/>
<span><00066> 000C094A R WM_PRINTCLIENT lResult: 00000000<br/>
<span><00067> 000C094A R WM_PAINT lResult: 00000000<br/>
<span><00068> 000C094A R WM_PSD_ENVSTAMPRECT fPreventDraw: False [lResult: 00000000]<br/>
<span><00069> 000C094A S WM_PSD_PAGESETUPDLG wPaper: 0000 wFlags: 0 lppsd: 00000000 [wParam: 00000000 lParam: 00000000]<br/>
<span><00070> 000C094A R WM_PSD_PAGESETUPDLG fPreventDraw: True [lResult: 00000004]<br/>
<span><00071> 000C094A S WM_PSD_ENVSTAMPRECT hDC: 00000001 lprcEnvStamp: 00000005 [wParam: 00000001 lParam: 00000005]
<span style="color:#333333; font-family:arial,sans-serif; font-size:15px; background-color:#f5f5f5 <span>WM_PSD_ENVSTAMPRECT <span style="color:#333333; font-family:arial,sans-serif; font-size:15px; background-color:#f5f5f5 <span>the <span>lparam <span>value <span>of
this <span>is <span>the object of <span>my <span>monitor<span>.

I wrote in C + + as follows hook.dll file, the following is my code.

<div style="color:Black;background-color:White; <pre>
LRESULT (CALLBACK __stdcall MessageProc(<span style="color:Blue; int code,WPARAM wParam,LPARAM lParam))
{
<span style="color:Blue; switch (code)
{
<span style="color:Blue; case WM_PSD_ENVSTAMPRECT:
lparamvalue=lParam;
};
<span style="color:Blue; return TRUE;

};


LRESULT (__stdcall SetHook(HWND hwnd4))
{
g_hWnd=hwnd4;
<span style="color:Green; //hThisHook= ::SetWindowsHookExA( WH_CALLWNDPROC,(HOOKPROC) PaintHookProc,hDll,GetWindowThreadProcessId(hwnd4,NULL) ); //GetWindowThreadProcessId(hwnd4,NULL)
<span style="color:Green; //hook = ::SetHook(hwnd4);

hThisHook= ::SetWindowsHookExW( WH_MSGFILTER,MessageProc,NULL,GetWindowThreadProcessId(hwnd4,NULL) ); <span style="color:Green; //GetWindowThreadProcessId(hwnd4,NULL)

<span style="color:Blue; if( hThisHook == NULL )
{
MessageBox(NULL, L<span style="color:#A31515; "Hook failure", L<span style="color:#A31515; "Title window hook fails", MB_OK);
<span style="color:Blue; return FALSE ;
}

<span style="color:Blue; if( hThisHook > NULL )
{
MessageBox(NULL, L<span style="color:#A31515; "Congratulations on your successful hook", L<span style="color:#A31515; "Linked the success of the title window", MB_OK);
<span style="color:Blue; return FALSE ;
}
<span style="color:Blue; return TRUE;
};


<span style="color:Blue; long (__stdcall Gethwnd())
{
HWND hwnd2 = ::GetDesktopWindow();

HWND hwnd3 = ::FindWindowExA(hwnd2,NULL,<span style="color:#A31515; "ThunderRT6FormDC", NULL);

hwnd4 = ::FindWindowExA(hwnd3,NULL,<span style="color:#A31515; "Slider20WndClass", NULL);


<span style="color:Blue; if (hwnd4 == NULL)
{
MessageBox(NULL, L<span style="color:#A31515; "Did not find window", L<span style="color:#A31515; "Title search window fails", MB_OK);
<span style="color:Blue; return FALSE ;
}

<span style="color:Blue; if (hwnd4 > NULL)
{
MessageBox(NULL, L<span style="color:#A31515; "Search to hug the window", L<span style="color:#A31515; "The success of the title search window", MB_OK);
<span style="color:Blue; return FALSE ;
}

<span style="color:Blue; return TRUE;
};
[/code]


I created dll file export function call to VB.net.

I have searched hwnd4 window, but when I have been linked to failure when linking information.

I do not know is the wrong type of hook, or where there are problems.

I put my C + + creates the file uploaded to skydriver for your reference.


<a title="123 https://skydrive.live.com/redir.aspx?cid=105b2868cb2df559&resid=105B2868CB2DF559!190

Reference to the relevant page hook:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms644990(v=vs.85).aspx http://msdn.microsoft.com/en-us/library/windows/desktop/ms644990(v=vs.85).aspx

View the full article
 
Back
Top