Im using EnumWindows and want to update this only when is change. Try to make hook WH_SHELL for the HSHELL_WINDOWCREATED but this is only local hook. How to make it global?
Asked
Active
Viewed 126 times
0
-
What do you mean by local/global here? – David Heffernan Jul 31 '14 at 19:33
-
i mean this only works for my application. For egxample "HSHELL_WINDOWACTIVATED" only is triggered when i click on window from my application. – mca64 Jul 31 '14 at 19:35
-
Do you want to know about activation or creation. There appears to bve some confusion. What are you trying to achieve? – David Heffernan Jul 31 '14 at 19:36
-
Possible duplicate of http://stackoverflow.com/q/299370/960757. – TLama Jul 31 '14 at 19:37
-
But perhaps you want a CBT hook http://msdn.microsoft.com/en-us/library/windows/desktop/ms644977(v=vs.85).aspx – David Heffernan Jul 31 '14 at 19:38
-
with "HSHELL_WINDOWACTIVATED" just was checkin if hook works, cause my application doesnt make new window. I wanna know about creation and destroy to update current list with windows. – mca64 Jul 31 '14 at 19:38
-
hmm CBT is the same for me, only local. In the past i was able to make global hook, but it was DLL and its was for keyboard. – mca64 Jul 31 '14 at 19:40
-
You installed the hook globally right? Using a DLL? – David Heffernan Jul 31 '14 at 19:42
-
no, in exe. Do i need to make dll? – mca64 Jul 31 '14 at 19:43
-
If you want a global hook, install a global hook. It will be injected into every process. You'll need 32 and 64 bit versions. – David Heffernan Jul 31 '14 at 19:44
-
@David, but which CBT hook code would you monitor ? The [`HCBT_CREATEWND`](http://msdn.microsoft.com/en-us/library/windows/desktop/ms644977%28v=vs.85%29.aspx#HCBT_CREATEWND) code (which I guess you are thinking of) indicates, that window is going to be created, and OP would have to wait (somehow) until the creation finishes before getting its name. Hence I've suggested [`HSHELL_WINDOWCREATED`](http://msdn.microsoft.com/en-us/library/windows/desktop/ms644991%28v=vs.85%29.aspx#HSHELL_WINDOWCREATED), because it indicates that a window has been created (passing its handle as a bonus). – TLama Jul 31 '14 at 19:52
-
"You'll need 32 and 64" Does this mean if my application is 32 bit i can only use hook for 32 bit app? – mca64 Jul 31 '14 at 19:53
-
A global hook is injected into every process. You might want to make your DLL light. Perhaps Delphi not ideal. – David Heffernan Jul 31 '14 at 19:55
-
What about an accessibility hook? Would that be more appropriate? – David Heffernan Jul 31 '14 at 19:59
-
" You might want to make your DLL light." Fortunelty i already made hook to block windows logo key in MASM, its only 3KB:) "What about an accessibility hook? Would that be more appropriate?" Dont understand it – mca64 Jul 31 '14 at 20:15
-
You wouldn't need to inject with an out of context accessibility hook. MASM might be sub optimal here, think of the IPC – David Heffernan Jul 31 '14 at 21:09
-
Have a look at [GPSysHook](http://17slon.com/gp/gp/gpsyshook.htm). It is a very well written component that also comes with a global shellhook – iamjoosy Aug 01 '14 at 09:08
-
hmmm now i think its better to not do in my app. I dont wanna integrate so much in Windows to be get this notifcation, but thanks for info. Now i know how it works. – mca64 Aug 01 '14 at 09:13