AutoHotkey Community

It is currently May 26th, 2012, 7:55 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 60 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject:
PostPosted: July 8th, 2009, 6:16 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
aandroyd wrote:
the OSD triggers for every wParam=12 event


Thank you. I will correct it.

Maria- wrote:
similar topic. sound alert whenver a network cable is unplugged. any idea?


Sorry! I do not know of a solution for it.

( Wake up forum! Wake up! )


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 22nd, 2009, 7:40 am 
I don't know if you're still working on this AutoHotKey trick or not, but if you are ...

You say "The shell receives HSHELL_GETMINRECT ( with a shellhook structure ) whenever a window is being Minimised/Maximised. A script may monitor it to Minimize a window to the tray." In the code I'm writing based on your techique I just need the hWnd member, but it isn't clear how you access it?

My script hides the taskbar before opening a program, but I want to restore the taskbar when the program exits, or when it is minimized or looses focus. In the last two cases I'll then hide the taskbar when the program becomes active again.

I've written the exit part, and am now working on the minimize part, but I don't see an event message that tells me when the window is loosing focus, only when it gets it back.

Thank you.


Report this post
Top
  
Reply with quote  
PostPosted: August 26th, 2009, 7:27 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
howardb1 wrote:
You say "The shell receives HSHELL_GETMINRECT ( with a shellhook structure ) whenever a window is being Minimised/Maximised. A script may monitor it to Minimize a window to the tray."


I was using Window 98 while I was experimenting.. and then I shifted My OS to 2k and currently using XP.
I can safely say HSHELL_GETMINRECT is very unpredictable in different OSes.
( If it works at all and ) If you are to use it only on your system, you are lucky. Otherwise, I do not recommend SHELLHOOK to monitor Maximize/Minimize events.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 7th, 2009, 10:04 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Does anybody have problems with Shell hook and activation ?

I don't receive notifications on Vista. For instance, here is the output of SKANs utuility where different windows were activated:



Code:
UNKNOWN  [32772]

hWnd   : 0x0
Title   :
Class   :

UNKNOWN  [32772]

hWnd   : 0x3f0184
Title   : EditPlus [_Taskbar] - [D:\Utils\_Scripts\autohotkey\Shell\1.ahk]
Class   : Afx:400000:8:10003:0:58044f

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

UNKNOWN  [32772]

hWnd   : 0x1e0118
Title   : Total Commander 7.04a
Class   : TTOTAL_CMD

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

UNKNOWN  [32772]

hWnd   : 0x3f0184
Title   : EditPlus [_Taskbar] - [D:\Utils\_Scripts\autohotkey\Shell\1.ahk]
Class   : Afx:400000:8:10003:0:58044f

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

UNKNOWN  [32772]

hWnd   : 0x0
Title   :
Class   :

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

UNKNOWN  [32772]

hWnd   : 0x3f0184
Title   : EditPlus [_Taskbar] - [D:\Utils\_Scripts\autohotkey\Shell\1.ahk]
Class   : Afx:400000:8:10003:0:58044f

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

UNKNOWN  [32772]

hWnd   : 0x1e0118
Title   : Total Commander 7.04a
Class   : TTOTAL_CMD

UNKNOWN  [32772]

hWnd   : 0x2a8051e
Title   : Tips N Tricks - Opera
Class   : OpWindow

UNKNOWN  [32772]

hWnd   : 0x0
Title   :
Class   :

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

UNKNOWN  [32772]

hWnd   : 0x2a8051e
Title   : Tips N Tricks - Opera
Class   : OpWindow

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

UNKNOWN  [32772]

hWnd   : 0x1e0118
Title   : Total Commander 7.04a
Class   : TTOTAL_CMD

HSHELL_SYSMENU  [9]

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

HSHELL_WINDOWDESTROYED  [2]

hWnd   : 0x0
Title   :
Class   :

HSHELL_REDRAW  [6]

hWnd   : 0x0
Title   :
Class   :

UNKNOWN  [32772]

hWnd   : 0x0
Title   :
Class   :

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2009, 9:34 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Activation definitely doesn't work correctly. The same code works on XP and doesn't work on VISTA, and sometimes it even stops working in XP.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 29th, 2010, 2:36 pm 
Offline

Joined: May 11th, 2009, 6:13 am
Posts: 28
i used shellhook code but while i right clicked 'my computer' on start menu to open 'system properties' i received nothing.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 29th, 2010, 3:40 pm 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
majkinetor wrote:
Does anybody have problems with Shell hook and activation ?
Yes here!

I'm glad its not just me thats having shell notification problems.
I thought I wasnt feeding the proper hWnd or something.

In some cases even normal Windows Messages are not detected with OnMessage.
I think there has to be a more robust method for using a given handle :? ..


majkinetor wrote:
here is the output of SKANs utuility
Where to find it plz?
Oh, its Shell Spy.. Got it :)

Ok so it looks like the hook method only works on toplevel windows.

There must be a way to hook all window and even control handles!

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 29th, 2010, 5:19 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
zhuluobin wrote:
i used shellhook code but while i right clicked 'my computer' on start menu to open 'system properties' i received nothing.


TLM wrote:
it looks like the hook method only works on toplevel windows.


SHELLHOOK works only on toplevel windows. The OS messages the Shell whenever a window is created/destroyed so that taskbar can update its buttons.
For windows which do not have a taskbar button, the messages will not be sent, which makes sense.

With SHELLHOOK method, we merely intercept the messages without much load on the system resources.

TLM wrote:
There must be a way to hook all window and even control handles!


Try WinEventHook Messages by Serenity


Last edited by SKAN on May 1st, 2010, 4:08 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 29th, 2010, 5:46 pm 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
SKAN wrote:
For windows which do not have a taskbar button, the messages will not be sent, which makes sense.
Explained that way, it absolutly does make sense!

thnx for the WinEventHook link :mrgreen:

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 28th, 2010, 4:41 am 
Offline

Joined: October 28th, 2010, 4:23 am
Posts: 9
SKAN wrote:
Code:
Gui +LastFound
hWnd := WinExist()

DllCall( "RegisterShellHookWindow", UInt,hWnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )

Return ;                                                 // End of Auto-Execute Section //

ShellMessage( wParam,lParam ) {
; Execute a command based on wParam and lParam
}



Hi,
THanks for this. I have a question regarding this? How do I add this code to default Autohotkey script that I use (the one with my regular hotkey /hotstrings etc?)

I tried adding this code as it is at end of the file , it doesn't work however.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 28th, 2010, 4:48 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
dotslashc wrote:
I tried adding this code as it is at end of the file , it doesn't work however.


Code:
Return ;                                                 // End of Auto-Execute Section //


Please refer AHK Documentation for 'auto-execute section'.
Revert back if you have a problem in understanding the concept.

:)


Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 28th, 2010, 8:23 am 
Offline

Joined: October 28th, 2010, 4:23 am
Posts: 9
SKAN wrote:
dotslashc wrote:
I tried adding this code as it is at end of the file , it doesn't work however.


Code:
Return ;                                                 // End of Auto-Execute Section //


Please refer AHK Documentation for 'auto-execute section'.
Revert back if you have a problem in understanding the concept.

:)


Silly me. :oops:
Thanks for the pointer.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2010, 8:53 am 
Offline

Joined: October 28th, 2010, 4:23 am
Posts: 9
Unfortunately not working for me still.
I am trying to include some other scripts i found here.
Code:
#include %A_ScriptDir%\My Scripts\notifylockunlock.ahk
#include %A_ScriptDir%\My Scripts\iSwitcher.ahk

notify_lock_unlock()
; Calls function "on_lock()" when computer is locked and "on_unlock()" when computer is unlocked


Does location of these lines make difference? My understanding is that #include directive execute the script in included AHK file immediately. Will the return command in included file affect what I am trying to do?

If I put above code before the following code
Code:
Gui +LastFound
hWnd := WinExist()

DllCall( "RegisterShellHookWindow", UInt,hWnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
Return


Then only iSwitcher and notifyunlocklock works. If I put it later only the "RegisterShellHookWindow" code works. :(

I really want to keep my include files seperate. Any workaround?


Last edited by dotslashc on October 28th, 2010, 8:59 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2010, 8:58 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
It is preferable that you use #include at the end of the script.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2010, 9:04 am 
Offline

Joined: October 28th, 2010, 4:23 am
Posts: 9
SKAN wrote:
It is preferable that you use #include at the end of the script.


Yup, tried this. Now my iSwitcher script is causing issue. The pretty UI of this script doesn't show up.

Edit: I guess I have no choice but to run iSwitcher in seperate script.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 60 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group