Advertisement
tic

List Windows

tic
Mar 21st, 2013
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pToken := Gdip_Startup()
  2.  
  3. WinGet, list, list
  4. nlist := {}
  5. loop % list
  6. {
  7.     WinGet, style, style, % "ahk_id " list%A_Index%
  8.     Transform, result, BitAnd, %style%, 0x10000000
  9.     if (result != 0)
  10.         nlist.Insert(list%A_Index%)
  11. }
  12.  
  13. data := {}, totalHeight := maxWidth := 0
  14. loop % nlist.MaxIndex()
  15. {
  16.     x := {}
  17.     x.bitmap := Gdip_BitmapFromHWND(nlist[A_Index])
  18.     Gdip_GetImageDimensions(x.bitmap, width, height)
  19.     x.width := width, x.height := height
  20.     totalHeight += x.height, maxWidth := (A_Index = 1 || x.width > data[A_Index-1].width) ? x.width : maxWidth
  21.     data.Insert(x)
  22. }
  23.  
  24. pBitmap := Gdip_CreateBitmap(maxWidth, totalHeight), G := Gdip_GraphicsFromImage(pBitmap), y := 0
  25. loop % nlist.MaxIndex()
  26. {
  27.     Gdip_DrawImage(G, data[A_Index].bitmap, 0, y, data[A_Index].width, data[A_Index].height)
  28.     Gdip_DisposeImage(data[A_Index].bitmap)
  29.     y += data[A_Index].height
  30. }
  31. Gdip_SaveBitmapToFile(pBitmap, "AllVisibleWindows.png")
  32. Gdip_DeleteGraphics(G), Gdip_DisposeImage(pBitmap)
  33. Gdip_Shutdown(pToken)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement