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 

Vista's live thumnail view

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
skrommel



Joined: 30 Jul 2004
Posts: 190

PostPosted: Sun Aug 03, 2008 11:48 pm    Post subject: Vista's live thumnail view Reply with quote

Smile Vista, anyone?

I finally found the solution to my own question in the Help section, using two fantastic tools:
heresy's EasyWinApi at http://www.autohotkey.com/forum/viewtopic.php?t=33464 and
Lexikos' StructParser at http://www.autohotkey.com/forum/viewtopic.php?t=27644.

The code makes a gui showing the content of the active window, just like Vista's taskbar thumnails

Code:
;VistaLiveThumbnailView.ahk
;Skrommel @ 2008

#SingleInstance,Force
#NoEnv
DetectHiddenWindows,On

zoom=2

WinGet,source,Id,A
Gui,Show,w300 h300
Gui,+LastFound
WinGet,target,Id,A
DetectHiddenWindows,On

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

_________________
www.1HourSoftware.com
Back to top
View user's profile Send private message Visit poster's website
zanthor



Joined: 11 Jul 2007
Posts: 10

PostPosted: Sat Sep 13, 2008 5:45 pm    Post subject: Reply with quote

Would it be possible to make this monitor 5 applications at the same time? I have 5 windows 4 of which won't necessarily be focus'd at any given time that I'd like to keep status on.

Edit: I just ran this and it brings up a lovely window, but the contents never change from just a blue gradient... I'm wondering if I'm doing something wrong here...
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2485

PostPosted: Sat Sep 13, 2008 7:20 pm    Post subject: Reply with quote

blank window... (XP Pro SP3)
Back to top
View user's profile Send private message Visit poster's website
wygd



Joined: 04 Nov 2007
Posts: 10

PostPosted: Sun Sep 14, 2008 6:46 am    Post subject: Reply with quote

nothing happen.
just a blank window.
Back to top
View user's profile Send private message
Serenity



Joined: 07 Nov 2004
Posts: 1271

PostPosted: Sun Sep 14, 2008 12:02 pm    Post subject: Reply with quote

I think this requires Vista as it uses DWMAPI.DLL.
_________________
"Anything worth doing is worth doing slowly." - Mae West
Back to top
View user's profile Send private message Visit poster's website
Lexikos



Joined: 17 Oct 2006
Posts: 7295
Location: Australia

PostPosted: Sun Sep 14, 2008 12:06 pm    Post subject: Reply with quote

As the title and first line of this thread suggest, it does indeed require Vista. Aero (i.e. desktop composition) must also be enabled for it to work.

To answer zanthor's question, there is no documented limit to the number of thumbnails that you may create.
Back to top
View user's profile Send private message Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2485

PostPosted: Sun Sep 14, 2008 3:01 pm    Post subject: Reply with quote

skrommel wrote:
The code makes a gui showing the content of the active window, just like Vista's taskbar thumnails

Lexikos wrote:
As the title and first line of this thread suggest, it does indeed require Vista. Aero (i.e. desktop composition) must also be enabled for it to work.
The title didn't suggest that to me. I had expected to see functionality similar to Vista's live thumbnail view. Thanks for clarifying Smile .
Back to top
View user's profile Send private message Visit poster's website
rukoche



Joined: 20 Feb 2008
Posts: 22

PostPosted: Sat Jun 06, 2009 6:56 pm    Post subject: Reply with quote

thanks for sharing this

how can I replace existing thumbnail in GUI or remove previous one before creating a new?

I'm destroying my GUI every time now, but I don't want this window flickering
Back to top
View user's profile Send private message
rukoche



Joined: 20 Feb 2008
Posts: 22

PostPosted: Sat Jun 06, 2009 11:03 pm    Post subject: Reply with quote

nvm, figured it out myself

Code:
un := DllCall("dwmapi.dll\DwmUnregisterThumbnail","UInt",thumbnail)
Back to top
View user's profile Send private message
jtuttle



Joined: 06 Nov 2008
Posts: 26

PostPosted: Mon Jun 29, 2009 2:02 am    Post subject: Reply with quote

Thanks for this. I fiddled with it a little.

Code:

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


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

#[::
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


It grabs the width/height of the active window and creates a thumbnail of the correct size based on the zoom multiplier. #] and #[ zoom in and out by 5%, respectively. I think it's nifty Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions 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