 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
0inprogram
Joined: 06 Dec 2007 Posts: 21 Location: chennai
|
Posted: Sat Dec 22, 2007 8:37 am Post subject: |
|
|
| how can i get the titlebar and conditionaly execute code, in tht same script |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Sat Dec 22, 2007 4:59 pm Post subject: |
|
|
| 0inprogram wrote: | | how can i get the titlebar and conditionaly execute code, in tht same script |
| 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 ) {
if ( wParam = 4 or wParam = 1 ) ; HSHELL_WINDOWACTIVATED / CREATED
{
WinGetClass, Class, ahk_id %lParam%
If Class in IEFrame,MozillaWindowClass,OpWindow
SetTimer, CheckWinTitle, 100
Else SetTimer, CheckWinTitle, OFF
}
}
CheckWinTitle:
WinGetTitle, Title, A
If InStr( Title, "youtube" )
or InStr( Title, "orkut" )
or InStr( Title, "autoit" ) ;)
WinClose, A
Return |
Somebody wrote a stupid prank with autohotkey, the above imitates it.
 |
|
| Back to top |
|
 |
0inprogram
Joined: 06 Dec 2007 Posts: 21 Location: chennai
|
Posted: Mon Dec 24, 2007 7:16 am Post subject: |
|
|
| it works fine with IE, but doesnt respond with firefox |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Mon Dec 24, 2007 7:24 am Post subject: |
|
|
| 0inprogram wrote: | | doesnt respond with firefox |
I have used the wrong window class.
It should have been MozillaUIWindowClass.
Also, I do not know the correct class name for opera.
I retrieved both of them from our forum's search.
 |
|
| Back to top |
|
 |
0inprogram
Joined: 06 Dec 2007 Posts: 21 Location: chennai
|
Posted: Tue Dec 25, 2007 5:35 am Post subject: |
|
|
thank u ........  |
|
| Back to top |
|
 |
thewer
Joined: 12 Feb 2008 Posts: 13 Location: Munich, Germany
|
Posted: Tue Feb 12, 2008 1:36 pm Post subject: |
|
|
Hi there -
I was experimenting with Skan's Example Nr. 5 as I wanted to do a script that - every time a window is maximized - maximizes the window to a certain size only.
Unfortunately I've got the same problems as shader (XP Prof. SP2, German version, one monitor only).
Took me some time to understand the script, but even now I can't get the HSHELL_GETMINRECT message:
I monitored the parameters
OnMessage( MsgNum, "ShellMessage" )
with
ShellMessages (Msg,hWnd,wParam,lParam)
Msgbox...
(I think the last two parameters only state what kind of message it is...)
While Msg monitors the creating and destroying etc. of any window correctly, max- and minimizing doesn't trigger the OnMessage with me.
(tried Skan's Example Nr. 4 - in this script, these actions don't show up, too)
Anyone got an idea why?
Thanks for your help!  |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Wed Feb 13, 2008 9:00 pm Post subject: |
|
|
| thewer wrote: | | Took me some time to understand the script, but even now I can't get the HSHELL_GETMINRECT message: |
HSHELL_GETMINRECT used to show up in my ShellSpy in Win98, 2K and XP, but it did not when I checked now.
I was late to suspect my nVidia display in which I had enabled fast minimize / maximize. It had been injecting a DLL proc into every window and was monitoring HSHELL_GETMINRECT !
My code works only if I disable it
I even tried SetWindowsHookEx to inject a Dll proc, but in vain.
My best guess is that nVidia is is not using CallNextHookEx, so no other app can receive that particular Shell notification.
Sorry for the delay in reply as it took me time for research.
 |
|
| Back to top |
|
 |
thewer
Joined: 12 Feb 2008 Posts: 13 Location: Munich, Germany
|
Posted: Thu Feb 14, 2008 1:52 pm Post subject: |
|
|
Hi -
thanks for your reply!
Yes, I've got an Nvidia card as well - disabled the fast min-/maximize and now it at least shows the HSHELL_GETMINRECT, every time I minimize a window, not on maximize or restore...
It really seems to be an interaction with the Nvidia Desktop Manager (I don't have a clue how you found out this one... ), interesting thing is, that you can't really disable the wretched thing (I had it disabled actually, still the fast minimize was set).
What I also did: After disabling the fast minimize, I switched off the "menu blending in" effects in the Windows desktop settings, so minimizing windows was fast again - Now the GETMINRECT doesn't show up anymore, too, but on minimizing a window the window is destroyed...
And - suddenly the HSHELL_WINDOWACTIVATED seems to have the code "32772" instead of "4"...
Maybe I should give up coding...  |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Thu Feb 14, 2008 2:34 pm Post subject: |
|
|
| Code: | | I don't have a clue how you found out this one... :o |
It used to work flawlessly before I upgraded the display, and hence it should have been obvious.
BTW, may I know what you are exactly upto.
There is a ahkhook.dll by JGR with which we can monitor window activities.
 |
|
| Back to top |
|
 |
thewer
Joined: 12 Feb 2008 Posts: 13 Location: Munich, Germany
|
Posted: Fri Feb 15, 2008 10:48 am Post subject: |
|
|
Hi -
what I'm trying to do is very similar to your example nr. 5, but maybe it's better to go into detail:
I normally use AveDesk for creating desklets/widgets and recently discovered the power of AHK, which can be nicely integrated.
So I got a kind of system information bar made with AveDesk on top of my screen (Landvermesser did similar stuff with AHK I think) and I don't want maximized windows to overlap it or vize versa the bar overlapping the window/ the window buttons.
Now I'm trying to create a script, that amongst others - every time a window is maximized - maximizes it to a certain size only (leaving a free space for the bar).
I thought the Shell hook would be the smoothest and fastest solution for it and probably the one eating the minimum resources (as the script would run all the time).
Guess the dll would be a solution, too, but so far I haven't understand anything about using it (moreover, there seem to be 3 dlls: a cbthook, a wineventhook a callbackhook, all mentioned in this thread...)
Last thing is of course - the hook should be fast, resizing the window best before maximizing it... Maybe a hook would be better watching the maximize/restore button press??
I thought about using WinMove() for resizing, not sure so as this makes a WinRestore() impossible, if I don't store the old x,y,w,h in a variable... |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Fri Feb 15, 2008 11:15 am Post subject: |
|
|
| thewer wrote: | | So I got a kind of system information bar made with AveDesk on top of my screen (Landvermesser did similar stuff with AHK I think) and I don't want maximized windows to overlap it or vize versa the bar overlapping the window/ the window buttons. | Detecting window maximize is probably the hard way. I think what you're describing can be done with "AppBars." SKAN posted a working example for creating an AppBar (see his second post), and there is also an example by Microsoft. |
|
| Back to top |
|
 |
jk7800
Joined: 06 Jan 2008 Posts: 39 Location: Gdi+ v1.1
|
Posted: Fri Feb 22, 2008 8:12 pm Post subject: |
|
|
Hi.
I've done a small script using Your RegisterHookShellWindow function, SKAN. It creates a vista-like fading when a new window is created. Maybe it can be an example?
| Code: | Gui +LastFound
DllCall("RegisterShellHookWindow",UInt,WinExist())
ShellHook:=DllCall("RegisterWindowMessage",Str,"SHELLHOOK")
OnMessage(ShellHook,"Message")
Return
Message(wParam,lParam)
{
exclude=#32770 ;If you don’t want to fade certain windows (don’t forget to use a separator)
if(wParam=1) ;HSHELL_WINDOWCREATED is 1
{
IfWinExist, ahk_id %lParam%
{
WinGetClass, class, ahk_id %lParam%
If(InStr(exclude, class)>0)
Return
WinSet, Transparent, 0, ahk_id %lParam%
Loop 8
{
Sleep, 1
Trans:=A_Index*32-1
WinSet, Transparent, %Trans%, ahk_id %lParam%
}
WinSet, Transparent, OFF, ahk_id %lParam%
}
}
} |
Hope you like it. |
|
| Back to top |
|
 |
jk7800
Joined: 06 Jan 2008 Posts: 39 Location: Gdi+ v1.1
|
Posted: Fri Feb 22, 2008 8:52 pm Post subject: |
|
|
thewer, you can also try to change the work area:
| Code: | SysGet, WorkArea, MonitorWorkArea
left := 0
right := A_ScreenWidth-0
top := 0
bottom := A_ScreenHeight-30-WorkAreaBottom ;WorkAreaBottom is needed to don't remove the place occupied by taskbar
VarSetCapacity( area, 16, 0 )
EncodeInteger( left, 4, &area, 0 ) ;Stores the region coordinates to memory
EncodeInteger( top, 4, &area, 4 )
EncodeInteger( right, 4, &area, 8 )
EncodeInteger( bottom, 4, &area, 12 )
DllCall( "SystemParametersInfo", "uint", 0x2F, "uint", 0, "uint", &area, "uint", 0 )
EncodeInteger( p_value, p_size, p_address, p_offset )
{
loop, %p_size%
DllCall( "RtlFillMemory"
, "uint", p_address+p_offset+A_Index-1
, "uint", 1
, "uchar", ( p_value >> ( 8*( A_Index-1 ) ) ) & 0xFF )
} |
Hope I helped. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Sat Feb 23, 2008 11:09 am Post subject: |
|
|
| jk7800 wrote: | | Hope you like it. |
Nice jk7800
I get a flicker when the windows is made transparent on Creation.
FYI, though it cannot be fully eliminated, adding the following lines reduces it:
| Code: | Process, Priority,, High
SetBatchlines -1 |
 |
|
| Back to top |
|
 |
thewer
Joined: 12 Feb 2008 Posts: 13 Location: Munich, Germany
|
Posted: Mon Feb 25, 2008 9:15 am Post subject: |
|
|
Hi -
sorry for the late reply (I'm moving at the moment and needed some time to set up my system again).
@lexiKos:
Thanks - this would be a solution, just not sure I understand all of Skan's appbar at the moment. But I think an invisible child window of the taskbar would do the trick...
@jk7800:
Thanks a lot, too - this sounds easy enough even for me!
Well, more questions to come for sure...  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|