Restored from previous forum. Originally posted by Kendrel.
I have coded a little app where i use SetWindowPos() to position the window... here is the code...
OpenPreferences("setpos.ini")
PreferenceGroup("Settings")
AppName.s=ReadPreferenceString("ApplicationName", "")
WindowX.l=ReadPreferenceLong ("WindowX", 0)
WindowY.l=ReadPreferenceLong ("WindowY", 0)
WindowW.l=ReadPreferenceLong ("WindowW", 0)
WindowH.l=ReadPreferenceLong ("WindowH", 0)
ClosePreferences()
handle=findwindow_(0,AppName)
setwindowpos_(handle,#HWND_BOTTOM,WindowX,WindowY,WindowW,WindowH,#SWP_FRAMECHANGED)
the code works and will set the new position once i run my code, but when i minimize (ive tested with icqlite) the programm and maximize again it has the old coordinates (not the one my code sets).
i have tried UpdateWindow() and some other things, but iam stuck on thos one... i have also played with the SetWindowPlacement(), but i dunno if i did something wrong... please help... iam stuck and getting mad...
THX ALOT
kendrel
SetWindowPos (Api Question)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
Does the bug occur if you use PureBasic's own MoveWindow() and/or SizeWindow() commands?
Also, if you absolutely *must* use the API, then try replacing:
SetWindowPos_(handle,#HWND_BOTTOM,WindowX,WindowY,WindowW,WindowH,#SWP_FRAMECHANGED)
with:
MoveWindow_(handle,WindowX,WindowY,WindowW,WindowH,#TRUE)
Does the bug occur if you use PureBasic's own MoveWindow() and/or SizeWindow() commands?
Also, if you absolutely *must* use the API, then try replacing:
SetWindowPos_(handle,#HWND_BOTTOM,WindowX,WindowY,WindowW,WindowH,#SWP_FRAMECHANGED)
with:
MoveWindow_(handle,WindowX,WindowY,WindowW,WindowH,#TRUE)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Kendrel.
i have also tried with movewindow_() and there is no difference i could see.
also i wonder how i can use purebasics internal Window commands, since iam resizing a foreign window... i dont see a way to give the handle of that window to MoveWindow() or ResizeWindow().
as i said, the code i posted works, but the old data seems be stored somewhere, and i dunno how to change that.
thx
i have also tried with movewindow_() and there is no difference i could see.
also i wonder how i can use purebasics internal Window commands, since iam resizing a foreign window... i dont see a way to give the handle of that window to MoveWindow() or ResizeWindow().
as i said, the code i posted works, but the old data seems be stored somewhere, and i dunno how to change that.
thx
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Berikco.
The application you try to set the windowsize holds it position in internal variables, and after minimize/maximize, it restores to that variables.
Maybe send a WM_SIZE and WM_MOVE message to the window with the new position in lParam? just a guess, they should already being send by use of setwindowpos_()
Regards,
Berikco
http://users.pandora.be/berikco/purebasic.htm
The application you try to set the windowsize holds it position in internal variables, and after minimize/maximize, it restores to that variables.
Maybe send a WM_SIZE and WM_MOVE message to the window with the new position in lParam? just a guess, they should already being send by use of setwindowpos_()
Regards,
Berikco
http://users.pandora.be/berikco/purebasic.htm