See if this is any good to you. Note that for it to work you'll need a file called "user32.decls" in your userlibs folder. You can find it here:
http://www.blitzbasic.com/codearcs/codearcs.php?code=1179
Disclaimer - there may very well be a simpler or better way to do what you asking. :)
Const SM_CXSCREEN=0
Const SM_CYSCREEN=1
graphicsW=api_GetSystemMetrics(SM_CXSCREEN) ;get desktop width
graphicsH=api_GetSystemMetrics(SM_CYSCREEN) ;get desktop height
Graphics3D graphicsW,graphicsH,0,2 ;initialise 3D graphics at desktop size/depth
hWnd=SystemProperty("apphWnd") ;get window handle
Const GWL_STYLE=(-16)
style=api_GetWindowLong(hWnd,GWL_STYLE) ;get window style
Const WS_MAXIMIZEBOX=$10000
Const WS_THICKFRAME=$40000
style=style+WS_MAXIMIZEBOX+WS_THICKFRAME ;add constants for maximize box and resizable border
api_SetWindowLong hWnd,GWL_STYLE,style ;modify window
Const HWND_TOP=0
api_SetWindowPos hWnd,HWND_TOP,(graphicsW-320)/2,(graphicsH-240)/2,320,240,0 ;defines initial 'restored down' position and size
Type rectStructure ;'rect' structure used by api_GetClientRect
Field x ;always zero?
Field y ;always zero?
Field w ;width
Field h ;height
End Type
Global clientArea.rectStructure=New rectStructure
camera=CreateCamera()
cube=CreateCube()
PositionEntity cube,0,0,5
light=CreateLight()
PositionEntity light,-5,5,0
While Not KeyHit(1)
Cls
api_GetClientRect hWnd,clientArea ;get dimensions of client area
CameraViewport camera,0,0,clientArea\w,clientArea\h ;resize camera viewport accordingly
TurnEntity cube,1,2,3
RenderWorld()
Text 10,10,"client area width="+clientArea\w
Text 10,25,"client area height="+clientArea\h
Flip
Wend
End
|