GetWindowPlacement_

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by crown.

does someone has an example on the GetWindowPlacement_
i need to get the position of a window on the desktop
used it before in vb, but don`t know how to do it in pb...


(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> i need to get the position of a window on the desktop

Open the Calculator and then run this...

Code: Select all

r=FindWindow_(0,"Calculator") ; Is Calculator running?
If r=0 ; 0 = Nope!
  Debug "Calculator not running!"
Else
  GetWindowRect_(r,win.RECT) ; Get Calculator's dimensions.
  x=win\left : y=win\top ; Get X and Y positions of Calculator.
  w=win\right-win\left : h=win\bottom-win\top ; Get width and height.
  Debug "X="+Str(x)+", Y="+Str(y)
  Debug "W="+Str(w)+", H="+Str(h)
EndIf

PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

Code: Select all

OpenWindow(1,200,300,400,100,#PB_Window_SystemMenu,"")GetWindowPlacement_(WindowID(),struct.WINDOWPLACEMENT)
;
; now the members of struct.WINDOWPLACEMENT are filled
cya,
...Danilo

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by crown.

Thanks alot, is there also a way to move/resize
the window?

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

PB:
MoveWindow()
ResizeWindow()

API:
SetWindowPos_()
MoveWindow_()

You should read some documentation
if you want to be a programmer.

cya,
...Danilo

(registered PureBasic user)
Post Reply