This AltTab replacement(
alpha) use majkinetor MMenu (
http://www.autohotkey.com/forum/viewtopic.php?t=17674) and also some DllCall from various post to create the preview.
Just press F1 to show the menu with current tasks, with their icons and a preview near the menu. In next days I will post screenshots and documentation.
If you like it, please send feedback
To install it just download this script and MMenu API or the zip pack above
alttab replacement
Code:
#Include includes
#include MMenu.ahk
#include structs.ahk
scale := 240
F1::
alttab()
return
alttab()
{
global
Gui, Destroy
trans_color := 000055
Gui +AlwaysOnTop +LastFound
Gui Color, %trans_color%, 0xcc4444
WinSet, TransColor, %trans_color%
Gui -Caption
;WinSet, Transparent, %translevel_start%
;Gui Add, Pic, x0 y0
CoordMode, Mouse, Screen
MouseGetPos, x,y
if(x<A_ScreenWidth/2)
x2:=x+320
else if(x>A_ScreenWidth/2 and x<A_ScreenWidth-250)
x2:=x-320
else
x2:=x-560
Gui Show, x%x2% y%y% w%scale% h%scale%, Preview 2349
WinGet hw_frame, id, Preview 2349
hdc_frame := DllCall( "GetDC"
, UInt, hw_frame )
DllCall( "gdi32.dll\SetStretchBltMode"
, "uint", hdc_frame
, "int", 4 ) ; Halftone better quality with stretch
hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC"
, UInt, hdc_frame) ; buffer
hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap"
, UInt,hdc_frame
, Int,A_ScreenWidth
, Int,A_ScreenHeight)
alttab_Menu := MMenu_Create()
;get windows list
Winget, ids, list, , , Program Manager
Loop, %ids%
{
id:=ids%A_Index%
Wingettitle, title, ahk_id %id%
;get icon
WinGet, pid, PID,ahk_id %id%
hProcess := DllCall("OpenProcess", "UInt", 0x0010 | 0x0400, "Int", false, "UInt", pid)
size := VarSetCapacity(filename, 250) ; max. length of filename
DllCall("Psapi.dll\GetModuleFileNameExA", "UInt", hProcess, "Int", 0, "Str", filename, "Int", size)
DllCall("CloseHandle", "UInt", hProcess)
;exclude docks window and not needed ones
If title not contains dock,Preview
if(title!="")
MMenu_Add( alttab_Menu, title, filename ":" 0)
}
MouseGetPos, x,y
MMenu_Show(alttab_Menu,x,y,"selTask","SOnSelect")
Gui, Destroy
return
}
selTask:
WinActivate, %M_STITLE%
MMenu_Destroy( alttab_Menu )
DllCall("gdi32.dll\DeleteObject", UInt,hbm_buffer)
DllCall("gdi32.dll\DeleteDC", UInt,hdc_frame )
DllCall("gdi32.dll\DeleteDC", UInt,hdc_buffer)
Gui, Destroy
return
OnSelect:
DllCall( "gdi32.dll\SelectObject"
, UInt,hdc_buffer
, UInt,hbm_buffer)
pics_added := 0
WinGet, task_id, Id, %M_STITLE%
WinGetTitle title, ahk_id %task_id%
WinGetPos,,, w, h, ahk_id %task_id%
if(w<30)
return
if(w>h)
{
width:=scale
height:=(h*scale)/w ; w:300=h:x
}
else
{
width:=(w*scale)/h
height:=scale
}
pwin := DllCall("PrintWindow", UInt,task_id, UInt,hdc_buffer, UInt,0)
DllCall("gdi32.dll\StretchBlt"
, UInt, hdc_frame
, Int, "0"
, Int, "0"
, Int, width
, Int, height
, UInt, hdc_buffer
, Int, 0
, Int, 0
, Int, w
, Int, h
, UInt, 0xCC0020) ; SRCCOPY
return