UnderwareDESIGN

PlayBASIC => Beginners => Topic started by: Adaz on October 22, 2008, 08:29:34 AM

Title: GetWindowRect
Post by: Adaz on October 22, 2008, 08:29:34 AM
Hi kevin,

What did I wrong? PB crashes if I run this:

[pbcode]

type RECT
 Left
 Right
 Top
 Bottom
endtype

dim lpRect as RECT

LinkDll "user32.dll"
   GetWindowRect (hwnd, lprect1) alias "GetWindowRect" As integer
EndLinkDll


err=GetWindowRect(getscreenhandle(), lpRect)

print lpRect.Left
print lpRect.Right
print lpRect.Top
print lpRect.Bottom

sync
waitkey
[/pbcode]
Title: Re: GetWindowRect
Post by: kevin on October 22, 2008, 09:00:01 AM
[pbcode]
type RECT
 Left
 Right
 Top
 Bottom
endtype

dim lpRect as RECT pointer
lprect = new rect

LinkDll "user32.dll"
   GetWindowRect (hwnd, lprect1) alias "GetWindowRect" As integer
EndLinkDll


err=GetWindowRect(getscreenhandle(), Int(lpRect))

if err

   print lpRect.Left
   print lpRect.Right
   print lpRect.Top
   print lpRect.Bottom
endif

sync
waitkey

[/pbcode]
Title: Re: GetWindowRect
Post by: Adaz on October 22, 2008, 10:26:47 AM
Thank you very much!