AutoHotkey Community

It is currently May 26th, 2012, 9:02 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: August 4th, 2008, 12:48 am 
Offline

Joined: July 30th, 2004, 8:50 pm
Posts: 192
:) 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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2008, 6:45 pm 
Offline

Joined: July 11th, 2007, 10:47 pm
Posts: 10
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...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2008, 8:20 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2543
blank window... (XP Pro SP3)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2008, 7:46 am 
Offline

Joined: November 4th, 2007, 5:48 pm
Posts: 10
nothing happen.
just a blank window.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2008, 1:02 pm 
Offline

Joined: November 8th, 2004, 12:46 am
Posts: 1271
I think this requires Vista as it uses DWMAPI.DLL.

_________________
"Anything worth doing is worth doing slowly." - Mae West
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2008, 1:06 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2008, 4:01 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2543
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 :) .


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 6th, 2009, 7:56 pm 
Offline

Joined: February 20th, 2008, 8:08 am
Posts: 22
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 7th, 2009, 12:03 am 
Offline

Joined: February 20th, 2008, 8:08 am
Posts: 22
nvm, figured it out myself

Code:
un := DllCall("dwmapi.dll\DwmUnregisterThumbnail","UInt",thumbnail)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 29th, 2009, 3:02 am 
Offline

Joined: November 6th, 2008, 7:43 pm
Posts: 26
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 :D


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: iBob35555VR and 12 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