JGR wrote:
I don't come here very often, so you need to PM me if you want a timely response.
...I'm wondering if you'll notice this reply...or if I should login & PM? I think I'll give it a few days/weeks & see if you notice this reply (you could subscribe to this thread, if you want to {& haven't already}).
JGR wrote:
Command prompt windows from what I remember don't behave like regular windows in various ways, so I'm not sure about how to go about hooking them.
...I'm not even sure if "hooking" or "injecting dll code" (into each window/process) is the right thing (maybe it's overkill?...or maybe it's the "only way" to do it?).
All I really want it to get notified when ANY window is created/destroyed/etc (& be able to take some action on the window {before it's visible}). SetWinEventHook seems to be able to do that, kinda, but I think I read that it
doesn't work if explorer.exe is not the shell. Now, explorer.exe is my shell, but I want to write the code in the most-portable way possible, just in case someone else don't use explorer.exe as their shell. Which is why I'm focusing on the CBTHookProc, it seems to be the only way to do what I want/need...is there any easier way I missed?
I want to make a Window Manager...& to be able to manage windows (for example position & size a window when it's "created", before it's visible), I need events for ALL windows. This would be dirt-simple, with a timer & checking the window list for new windows, however, that doesn't catch the windows
before they are visible (although I could resort to that to handle Command Prompt windows, if absolutely necessary {why are they so difficult? Can
nothing hook them?}).
JGR wrote:
...but I am around if you still want to discuss the matter.
...of course I do!!!
Also, for my own purposes, I'm targeting WinXP...so whatever code we come up with has to run on my WinXP (not use Vista or higher APIs)...of course I also want to support Vista/Win7, if possible...but this program would be useless to me if it don't support XP. However, since I'm curious, is "hooking windows" or even simply "receiving events about windows" any easier on Vista/Win7? Did Microsoft write any new APIs to help this problem? I don't want to have to inject code into all windows (& not be able to inject into some windows), but it seems like that's all Microsoft made possible.
Bottom line: As far as I can tell a CBT Hook, with a CBTHookProc function inside a dll,
seems to be my only option. So if you could compile a CBTHookProc function in a dll (or even a dll that includes all the *Proc functions), that would send messages to an AutoHotkey window (& accept/pass responses back to Windows), I think, that would do what I need. I have ideas about the params needed to pass to/from the dll somewhere. I know 1 problem with the current dlls is I can't register the hook myself (or does the dll,
need to register the hook itself?) & I can't change the window/hwnd the dll is talking to at runtime.