 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
TheIrishThug
Joined: 19 Mar 2006 Posts: 379
|
Posted: Sun May 18, 2008 10:17 pm Post subject: Get new coords after a window is moved? |
|
|
| I'm trying to write a program that monitor and arrange windows that belong to a certain program. The problem is I don't know what windows message or event I can hook into in order for my program to know that one of the windows I'm watching was just moved and get the new coordinates of the window's location. Anyone know what I need for this? |
|
| Back to top |
|
 |
Trikster
Joined: 15 Jul 2007 Posts: 1194 Location: Enterprise, Alabama
|
Posted: Sun May 18, 2008 10:23 pm Post subject: |
|
|
| Code: | OnMessage(0x201, "Gui_Move")
GUI_Move(wParam, lParam)
{
global active_ID, ini_guiposX, ini_guiposY
CoordMode, Mouse, Screen
MouseGetPos, Xpos, Ypos, OutputvarWin, OutputVarControl
WinGetPos, winXpos, winYpos, , , ahk_id %active_ID%
if (OutputvarWin = active_ID)
{
if (OutputVarControl = "")
{
xoffset := Xpos - winXpos
yoffset := Ypos - winYpos
; MsgBox, %xoffset% - %yoffset%
Loop
{
GetKeyState, state, LButton
if state = D
{
MouseGetPos, Xpos, Ypos
ini_guiposX := Xpos - Xoffset
ini_guiposY := Ypos - Yoffset
Gui,1: show, x%ini_guiposX% y%ini_guiposY%,
}
else
break
}
}
}
return
} |
Posted by Zed Gecko in the thread [Desktop Widget] RUN-Box _________________ ScriptPad/~dieom/dieom/izwian2k7/Ian/God
 |
|
| Back to top |
|
 |
TheIrishThug
Joined: 19 Mar 2006 Posts: 379
|
Posted: Sun May 18, 2008 11:00 pm Post subject: |
|
|
I cannot seem to make the RunBox example work as stated. Gui_Move was being triggered, but the OutputvarWin was never equal to active_ID.
Also, I thought OnMessage only worked for when the AHK script received the message. If this is true, then I would need more than just OnMessage, because I want to watch windows of other applications. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|