Hey what's up. I know I need to implement a hook in order to catch messages from another window outside my application's process. The only problem is, there are multiple windows to work with and I plan on using GetClassName to sift through the mass of messages. I don't know what kind of hook to use, and I know the code is so simple. Also, how do I make a routine call to a callback. Like when the calling process does 'invoke startHook,ADDR myProc', I want to be able to call the myProc routine from the dll's code. I've looked at the examples here on the site, and elsewhere, but they're either bloated with extras and it's too hard for me to weed out only what I need. I know the code is SO simple, I just can't seem to get it. I'm a bit stupid here... Is it possible to get the process id of a program that isn't started with my application, and set a hook to catch messages only from that process? I don't know.. I'm so lost, and I can do so much with this.
Masm32 - winxp sp1
Masm32 - winxp sp1
I do a system wide cbt hook and then subclassing the windows.
to get the process id use GetWindowThreadProcessId
to get the process id use GetWindowThreadProcessId
I got an example (c++) that uses
what struct is passed to wParam? How do I make asm code 'walk' through the values in the struct? Or what is it, heh.
The example uses SetWindowLong, I know I should try b4 I ask, but I heard you couldn't use SetWindowLong on other processes. It uses a WH_CBT hook w/ HCBT_CREATEWND to watch for 'new' windows, then it uses SetWindowLong...
Posted on 2003-08-29 17:08:56 by Xeek
LRESULT CALLBACK ShellDll_MainHook(int nCode, WPARAM wParam, LPARAM lParam)
.
.
HWND hwndToNewWindow = reinterpret_cast<HWND>(wParam);
what struct is passed to wParam? How do I make asm code 'walk' through the values in the struct? Or what is it, heh.
The example uses SetWindowLong, I know I should try b4 I ask, but I heard you couldn't use SetWindowLong on other processes. It uses a WH_CBT hook w/ HCBT_CREATEWND to watch for 'new' windows, then it uses SetWindowLong...
Posted on 2003-08-29 17:08:56 by Xeek
I example is for subclassing the msn right ?
wParam is not a struct, it is the handle of the window that is gonna be created
wParam is not a struct, it is the handle of the window that is gonna be created
yea, it's the one for msn, does it work... i mean if you were to build off the source...
no struct? this should make things easier ;)
no struct? this should make things easier ;)
that msn example does not work, it needs the variables to be shared
in c++ is #pragma something, I dont remember.
in c++ is #pragma something, I dont remember.
GRRRRR.... :(
#pragma data_seg(".shared")
static HHOOK g_hHook = NULL; // handle to our hook
#pragma data_seg()
is it something like that, i don't have a clue :\yap
thats for c++.
then you have to tell the linker that that segment is gonna be, rws
read, write, shared
thats for c++.
then you have to tell the linker that that segment is gonna be, rws
read, write, shared
looks like i won't be translating it to asm :(
oh well, so the SetWindowLong api will work if that shit is shared?
I'm using vc++6, how do i set the linker options?
oh well, so the SetWindowLong api will work if that shit is shared?
I'm using vc++6, how do i set the linker options?
I dont know, I dont use VC++
but it is a #pragma thing too
but it is a #pragma thing too