Tracking window title change
-
- Posts: 23
- Joined: Fri Jun 03, 2005 2:17 pm
Tracking window title change
I'd like to track all window title changes that occur within a given session, I've managed to successfully do this hook SendMessageA/W and PostMessageA/W.
Is there any function one could intercept, or an event to subscribe, in order to get notified off all window title changes?
Thanks in advance,
SittingBull
Is there any function one could intercept, or an event to subscribe, in order to get notified off all window title changes?
Thanks in advance,
SittingBull
-
- Posts: 23
- Joined: Fri Jun 03, 2005 2:17 pm
I'm using madchook's injection lib for system wide hooking, so SetWindowsHookEx had to be used localy for each process. Can this be done? Using SetWindowsHookEx on the local process?madshi wrote:You could use SetWindowsHookEx, I guess, and catch WM_SETTEXT messages.
Or is there any other way of intercepting it? Perhaps something in a lower level...
-
- Posts: 23
- Joined: Fri Jun 03, 2005 2:17 pm
Given the architecture of the application I'm creating this cant be done (I need to hook system processes, and my main process has to run on the system account).madshi wrote:Well, you could stop using madCodeHook and use SetWindowsHookEx instead.
It might be better for performance than hooking sendmessage and postmessage, I belive! Maybe i'll try this.madshi wrote:You could also do one SetWindowsHookEx call for each process, but that doesn't sound very good for performance.
Mean while I've been wondering if one could hook the windowproc to monitor WM_SETTEXT. What do you think about this?
Thanks for your replys
Why? Are you having performance problems with SendMessage + PostMessage hooking?SittingBull wrote:It might be better for performance than hooking sendmessage and postmessage, I belive!
You can do that by subclassing each window by calling SetWindowLong(GWL_WNDPROC). But I don't recommend that. Subclassing every window sounds like overkill to me!!SittingBull wrote:Mean while I've been wondering if one could hook the windowproc to monitor WM_SETTEXT. What do you think about this?
-
- Posts: 23
- Joined: Fri Jun 03, 2005 2:17 pm
It affects a bit the performance (CPU appears with current usage about 2-5% never touching 0%, by desactivating this hook cpu usage touches 0 sometimes), since every message in the system is scanned only to find the WM_SETTEXT .madshi wrote:Why? Are you having performance problems with SendMessage + PostMessage hooking?
But the main problem is that hooking this functions hangs up an application I have (a scanner related application, for digitalization process management), when I'm not hooking the sendmessage and postmessage it works fine! I belive it has something to do with the apperance of a message box in the window, perhaps because I'm comunicating with the applications main process inside the hook.
Hum, you're right, it might even be worst than what I have.madshi wrote:You can do that by subclassing each window by calling SetWindowLong(GWL_WNDPROC). But I don't recommend that. Subclassing every window sounds like overkill to me!!
-
- Posts: 23
- Joined: Fri Jun 03, 2005 2:17 pm
Yes thats the problem, I've to comunicate with the main process, the only overhead is that the hook has to find out if a window is a toplevel application window (only comunicates WM_SETTEXT for those windows).madshi wrote:How does your PostMessage/SendMessage hook code look like? The hook itself should not noticably impact performance. Probably it's what you're doing inside the hook callback function, which is the problem.
An aditional overhead comes when one window is determined to be top level, and the title has to be comunicated to my applications main process.
How could one fastly determine if a window is top level?
-
- Posts: 23
- Joined: Fri Jun 03, 2005 2:17 pm