How to move a layered window? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
c7aesa7r
Posts: 209
Joined: 02 Jun 2016, 21:09

How to move a layered window?

19 Apr 2021, 08:48

Code: Select all

pToken := Gdip_Startup()

OnMessage(0x0201, "WM_LBUTTONDOWN")

; Create a layered window (+E0x80000 : must be used for UpdateLayeredWindow to work!) that is always on top (+AlwaysOnTop), has no taskbar entry or caption
Gui, +E0x80000 +LastFound +AlwaysOnTop +OwnDialogs
Gui,  Show, NA

gui_hwnd := WinExist()

createWindow(file,gui_hwnd)

return

createWindow(file,hwnd) {
pBitmap := Gdip_CreateBitmapFromFile(file)
W := Gdip_GetImageWidth(pBitmap) , H := Gdip_GetImageHeight(pBitmap)

hbm := CreateDIBSection(W, H) , hdc := CreateCompatibleDC() , obm := SelectObject(hdc, hbm) , G := Gdip_GraphicsFromHDC(hdc)

Gdip_DrawImage(G, pBitmap, 0, 0, W, H, 0, 0, W, H)

UpdateLayeredWindow(hwnd, hdc, 0, 0, W, H)

DeleteDC(hdc) , DeleteObject(hbm) , Gdip_DeleteGraphics(G)

}

WM_LBUTTONDOWN() {
   If (A_Gui) {
      PostMessage, 0xA1, 2
   }
}
I tried to use OnMessage(0x0201, "WM_LBUTTONDOWN") but it still does not move.
c7aesa7r
Posts: 209
Joined: 02 Jun 2016, 21:09

Re: How to move a layered window?

19 Apr 2021, 11:38

That simple :?
Thank you!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 214 guests