AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Tips N Tricks] How to set a 'Tiled background' for GUI ?
Goto page Previous  1, 2, 3 ... 22, 23, 24 ... 31, 32, 33  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
0inprogram



Joined: 06 Dec 2007
Posts: 21
Location: chennai

PostPosted: Sat Dec 22, 2007 8:37 am    Post subject: Reply with quote

how can i get the titlebar and conditionaly execute code, in tht same script
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Sat Dec 22, 2007 4:59 pm    Post subject: Reply with quote

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.

Smile
Back to top
View user's profile Send private message Send e-mail
0inprogram



Joined: 06 Dec 2007
Posts: 21
Location: chennai

PostPosted: Mon Dec 24, 2007 7:16 am    Post subject: Reply with quote

it works fine with IE, but doesnt respond with firefox
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Mon Dec 24, 2007 7:24 am    Post subject: Reply with quote

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.

Smile
Back to top
View user's profile Send private message Send e-mail
0inprogram



Joined: 06 Dec 2007
Posts: 21
Location: chennai

PostPosted: Tue Dec 25, 2007 5:35 am    Post subject: Reply with quote

thank u ........ Smile
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
thewer



Joined: 12 Feb 2008
Posts: 13
Location: Munich, Germany

PostPosted: Tue Feb 12, 2008 1:36 pm    Post subject: Reply with quote

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! Smile
Back to top
View user's profile Send private message Visit poster's website
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Wed Feb 13, 2008 9:00 pm    Post subject: Reply with quote

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. Shocked

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 Sad

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.

Smile
Back to top
View user's profile Send private message Send e-mail
thewer



Joined: 12 Feb 2008
Posts: 13
Location: Munich, Germany

PostPosted: Thu Feb 14, 2008 1:52 pm    Post subject: Reply with quote

Hi -
thanks for your reply! Smile

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... Surprised ), 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... Shocked
Back to top
View user's profile Send private message Visit poster's website
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Thu Feb 14, 2008 2:34 pm    Post subject: Reply with quote

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. Smile

BTW, may I know what you are exactly upto.
There is a ahkhook.dll by JGR with which we can monitor window activities.

Smile
Back to top
View user's profile Send private message Send e-mail
thewer



Joined: 12 Feb 2008
Posts: 13
Location: Munich, Germany

PostPosted: Fri Feb 15, 2008 10:48 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Fri Feb 15, 2008 11:15 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
jk7800



Joined: 06 Jan 2008
Posts: 39
Location: Gdi+ v1.1

PostPosted: Fri Feb 22, 2008 8:12 pm    Post subject: Reply with quote

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? Smile

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
View user's profile Send private message
jk7800



Joined: 06 Jan 2008
Posts: 39
Location: Gdi+ v1.1

PostPosted: Fri Feb 22, 2008 8:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Sat Feb 23, 2008 11:09 am    Post subject: Reply with quote

jk7800 wrote:
Hope you like it.


Nice jk7800 Smile

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


Smile
Back to top
View user's profile Send private message Send e-mail
thewer



Joined: 12 Feb 2008
Posts: 13
Location: Munich, Germany

PostPosted: Mon Feb 25, 2008 9:15 am    Post subject: Reply with quote

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! Very Happy

Well, more questions to come for sure... Wink
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 22, 23, 24 ... 31, 32, 33  Next
Page 23 of 33

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group