This is little demonstration of mechanism to pin window on the desktop and write into invisible edit field there. If you hover your mouse over the text, white rectangle will appear witch you can use to move the text around (like caption). Double click the caption to exit.
This demonstration will display top level windows on your desktop.
This is the
screenshot
Code:
#SingleInstance, force
SetBatchLines, -1
;set the messages
WM_MOUSEMOVE = 0x200
WM_ACTIVATE = 0x06
GW_HWNDNEXT = 2
OnMessage(WM_ACTIVATE, "OnActivate")
OnMessage(WM_MOUSEMOVE, "OnMouseMove")
;--------- setup ------------------
gWidth := 420
gHeight := 320
gTitleHeight := 15
gRefresh := 500
;-----------------------------------
Gui, -Caption +LastFound +ToolWindow
hwnd := WinExist()
;add caption
Gui, Font, ,Webdings
Gui, Add, Text, x0 y0 w%gWidth% h%gTitleHeight% GuiMove CFFFFFF, g
Gui, Font, ,Courier New
;set trans color
Gui, Color,EEAA99 , EEAA99
WinSet, TransColor, EEAA99
;add edit control
Gui, Add, Edit, x0 y0 w%gWidth% h%gHeight% cYELLOW -0x200000 -0x4000 -E0x200, Refreshing....
;pin to desktop and show
WinSet, Bottom
Gui, Show, w%gWidth% h%gHeight% X250 Y250 NoActivate
;set timer to refresh text in the edit
SetTimer Refresh, %gRefresh%
return
;--------------------------------------------------------------------------
Refresh:
GuiControl, ,Edit1, % "TOP LEVEL WINDOWS`n_________________`n`n" GetTopLevelWindows()
return
;--------------------------------------------------------------------------
uiMove:
if (A_GuiControlEvent = "DoubleClick")
ExitApp
PostMessage, 0xA1, 2,,, A
return
;--------------------------------------------------------------------------
OnMouseMove()
{
global
if !titleVis
{
GuiControl, Move, Edit1, % "y" gTitleHeight + 5
WinSet, Redraw
titleVis := true
SetTimer TitleTimer, 3000
}
}
;--------------------------------------------------------------------------
TitleTimer:
SetTimer TitleTimer, off
GuiControl, Move, Edit1, y0
titleVis := false
return
;--------------------------------------------------------------------------
OnActivate(wparam, lparam)
{
global
WinSet, Bottom
}
;--------------------------------------------------------------------------
OnTimer:
SetTimer OnTimer, off
WinSet, Style, -0xC00000, ahk_id %hwnd%
WinSet Redraw
PostMessage, 0x111, 28931,,, ahk_class Progman
WinSet, Bottom
return
;--------------------------------------------------------------------------
GetTopLevelWindows()
{
local title, res, next, i
next := DllCall("GetWindow", "uint", hwnd, "uint", GW_HWNDFIRST)
loop
{
if !DllCall("IsWindowVisible", "uint", next)
goto jump
WinGetTitle, title, ahk_id %next%
if InStr(res, title) > 0
goto jump
if (title != "") && (title != "Program Manager") && (title != A_ScriptName)
{
res = %res%%title%`n
i++
}
jump:
next := DllCall("GetWindow", "uint", next, "uint", GW_HWNDNEXT)
if (next = 0)
break
}
res := res "`nTotal: " i
return res
}