PostMessage 0xA1 - Move Window

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Tvlao
Posts: 35
Joined: 29 Jun 2023, 03:39

PostMessage 0xA1 - Move Window

13 Feb 2024, 23:35

Need to move the window by pressing for example F1 + LButton.
Like this:

Code: Select all

TGui := Gui('+Resize', "NWin")
TGui.BackColor := "EEAA99"
TGui.Show("x0 y0 w200 h100") 

F1 & LButton::{
    While( getKeyState("LButton", "P") ) {	
        PostMessage 0xA1, 2,,, TGui.Hwnd
        Sleep(20)
    } 
}

But this does not move the window as should be expected.
PostMessage 0xA1 - does nothing.
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: PostMessage 0xA1 - Move Window

14 Feb 2024, 02:36

Not sure why that doesn't work, but this does:

Code: Select all

TGui := Gui('+Resize', "NWin")
TGui.BackColor := "EEAA99"
TGui.Show("x0 y0 w200 h100") 
OnMessage(0x201, WM_LBUTTONDOWN)

WM_LBUTTONDOWN(*) {
	if GetKeyState('F1', 'P')
		PostMessage 0xA1, 2
}
Tvlao
Posts: 35
Joined: 29 Jun 2023, 03:39

Re: PostMessage 0xA1 - Move Window

14 Feb 2024, 03:47

But this doesn't work when the window is transparent.

Code: Select all

WinSetTransColor TGui.BackColor " 200", TGui
And would like to move any window like this:

Code: Select all

PostMessage 0xA1, 2,,, TGui.Hwnd
Without complicated coding.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: DavidP, FanaticGuru, mikeyww, TomDonovan and 108 guests