BoBoĻ Guest
|
Posted: Thu Sep 13, 2007 3:00 pm Post subject: WinGetPos delivers hex values |
|
|
Hi, I've checked the announcement section if what occurs to be a bug has been solved/fixed already. But it doesn't look so. Here we go.
I've created an AHK GUI. To 'dock' additional GUIs to the master GUI I use WinExist() to get it's handle (hex, OK) which I'll use later with a DllCall(). Afterwards I try to get the position of the window itself using WinGetPos.
What's confusing me - WinGetPos delivers (now?) X+Y as hex values too (can't find anything about that in the help). Therefore it needs me to do a conversion of that values, because the following GUI, x:Show's doesn't accept those hex values as x/y coordinates.
The whole code block is used within a function.
AHK 1.0.47.01
XP Pro SP2
| Code: | GUICall(sessionID,LFMPath)
{
.
.
.
Gui, Margin, 0,0
Gui +DisplayAlbumCover +LastFound -Caption +AlwaysOnTop +Border +ToolWindow
Gui, Add, Picture, x0 y0 w130 h130, %AlbumCover%
OnMessage(0x200, "WM_MOUSEMOVE")
Gui, Show, AutoSize Hide, DisplayAlbumCover
GUI_ID1:=WinExist("DisplayAlbumCover")
WinGetPos, GUI1X, GUI1Y, GUI1Width, GUI1Height, DisplayAlbumCover
SetFormat, integer, d
GUI1X += 0
GUI1Y += 0
GUI1Width += 0
GUI1Height += 0
DW += 0
Gui, 2:Margin, 0,0
Gui, 2:Font,, Courier New
Gui 2:+DisplayArtist +LastFound -Caption +AlwaysOnTop +ToolWindow
Gui, 2:Add, Text, xm+10, Artist:`t%ArtistName%
Gui, 2:Show, % "x" . (GUI1X+GUI1Width) . " y" . (GUI1Y) . " w" . DW . " h24 Hide", DisplayArtist
GUI_ID2:=WinExist("DisplayArtist")
.
.
.
} |
To reproduce that behaviour I've created the following code snippet. With the result that WinGetPos delivered now decimal values
| Code: | !y:: ; press Alt+Y
CallWinGetPos()
Gui, Destroy
Return
CallWinGetPos()
{
Gui, +GUITest +LastFound -Caption +AlwaysOnTop +Border +ToolWindow
Gui,Add, Text,, Test
Gui, Show, Autosize, GUITest
GUI_ID1:=WinExist("GUITest")
WinGetPos, GX, GY, Width, Height, GUITest
MsgBox % Gx "`n" GY "`n" GUI_ID1
Return
} |
|
|