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 

Multiple GUI windows off same function + scrollbars

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
jtuttle



Joined: 06 Nov 2008
Posts: 26

PostPosted: Thu Jul 02, 2009 12:33 pm    Post subject: Multiple GUI windows off same function + scrollbars Reply with quote

Two questions, related only in that I want to use them both in an app. I lifted some code from this thread to make a nifty little picture-in-picture type app.

Firstly, my code:

Code:
Menu, Tray, Tip, Picture-in-picture!
Menu, Tray, NoStandard
Menu, Tray, Add, Close Thumbnail, KillThumb
Menu, Tray, Add, Exit, Exit

ZoomNao := .25
#T::
WinGetActiveStats, ThumbTitle, ThumbWide, ThumbHigh, X, Y
zoom=%ZoomNao%
NuWide := ThumbWide * ZoomNao
NuHigh := (ThumbHigh - 25) * ZoomNao
WinGet,source,Id,A
Gui, +AlwaysOnTop -SysMenu +ToolWindow
Gui,Show,w%NuWide% h%NuHigh%, PIP of %ThumbTitle%
Gui,+LastFound
WinGet,target,Id,A
Goto ThumbMake
Return


^WheelUp::
Gui, Submit
ZoomNao += .05
Goto #T
Return

^WheelDown::
Gui, Submit
ZoomNao -= .05
Goto #T
Return

ThumbMake:
VarSetCapacity(thumbnail,4,0)
hr1:=DllCall("dwmapi.dll\DwmRegisterThumbnail","UInt",target,"UInt",source,"UInt",&thumbnail)
thumbnail:=NumGet(thumbnail)

/*
DWM_TNP_RECTDESTINATION (0x00000001)
Indicates a value for rcDestination has been specified.
DWM_TNP_RECTSOURCE (0x00000002)
Indicates a value for rcSource has been specified.
DWM_TNP_OPACITY (0x00000004)
Indicates a value for opacity has been specified.
DWM_TNP_VISIBLE (0x00000008)
Indicates a value for fVisible has been specified.
DWM_TNP_SOURCECLIENTAREAONLY (0x00000010)
Indicates a value for fSourceClientAreaOnly has been specified.
*/

dwFlags:=0X1 | 0x2 | 0x10
opacity:=150
fVisible:=1
fSourceClientAreaOnly:=1

WinGetPos,wx,wy,ww,wh,ahk_id %target%

VarSetCapacity(dskThumbProps,45,0)
;struct _DWM_THUMBNAIL_PROPERTIES
NumPut(dwFlags,dskThumbProps,0,"UInt")
NumPut(0,dskThumbProps,4,"Int")
NumPut(0,dskThumbProps,8,"Int")
NumPut(ww,dskThumbProps,12,"Int")
NumPut(wh,dskThumbProps,16,"Int")
NumPut(0,dskThumbProps,20,"Int")
NumPut(0,dskThumbProps,24,"Int")
NumPut(ww/zoom,dskThumbProps,28,"Int")
NumPut(wh/zoom,dskThumbProps,32,"Int")
NumPut(opacity,dskThumbProps,36,"UChar")
NumPut(fVisible,dskThumbProps,37,"Int")
NumPut(fSourceClientAreaOnly,dskThumbProps,41,"Int")
hr2:=DllCall("dwmapi.dll\DwmUpdateThumbnailProperties","UInt",thumbnail,"UInt",&dskThumbProps)
Return

Exit:
Exitapp

KillThumb:
Gui, Submit
Return


First question: How would I go about making another key, like #Y, spawn another window like the one created by #T, without it replacing the first one? IE I want multiple such windows. I can do this now by running multiple instances of the script but this is a messy solution at best.

Second question: If I were to make one of these windows resizable, how would I get scrollbars on it, enabling me to shrink it and scroll around the image inside it?

Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
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