Hi, I'm writing an app that requires a window to be "always on top". However, I've found that MaxGUI's Query() returns a different hWND to that of Windows API. In some circumstances the Query() one works and in other cases you have to use the Windows API hWND.
wndMain = CreateWindow("Original Text",400,400,400,300,0,15)
Extern "win32"
Function GetActiveWindow()
Function SetWindowText(hWND%,strWindowText$) = "SetWindowTextA@8"
Function SetWindowPos(hWND%,zorder%,xpos%,ypos%,width%,height%,flags%)
End Extern
DebugLog ""
DebugLog "Query(wndMain,1) It: " + Query(wndMain,1)
DebugLog "Windows API It: " + GetActiveWindow()
Rem
If you try the Windows API hWND to change the Window's Text then it messes up.
However, if you try it with Query()'s hWND then it works fine.
End Rem
SetWindowText(Query(wndMain,1),"Changed Window Text") 'Works fine with Query()
'SetWindowText(GetActiveWindow(),"Changed Window Text") 'Doesn't work with API
Rem
However, Query()'s hWND doesn't work if you try to make the window on top,
but instead the Windows API one does?!?!? - Is this really weird?
End Rem
'SetWindowPos(Query(wndMain,1),-1,0,0,0,0,43) ' Doesn't work with Query()
SetWindowPos(GetActiveWindow(),-1,0,0,0,0,43) ' Works fine with API
Repeat
Select WaitEvent()
Case EVENT_WINDOWCLOSE;End
End Select
Forever Why are the two values different? - Is this a bug with Blitz? Incase this might be an O/S related issue I'm running XP Pro (SP2). Could anyone else try this code and make sense of what's happening?
Cheers
Seb
|