[bb] Create a maximized sized window. by Zethrax [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:40

Previous topic - Next topic

BlitzBot

Title : Create a maximized sized window.
Author : Zethrax
Posted : 1+ years ago

Description : The code below will create a window that has the same positioning and dimensions (give or take) as a maximized window. The position of the window will not be anchored in place the way normal maximized windows are, though.

You will also need to create a text file called 'user32.decls' with the two lines of code below in it and put the file in the userlibs folder in the Blitz main folder:-

--

.lib "user32.dll"
api_GetSystemMetrics% (nIndex%) : "GetSystemMetrics"


Code :
Code (blitzbasic) Select
; -- Declare Windows API constants.
Const SM_CXSCREEN_ = 0
Const SM_CYSCREEN_ = 1
Const SM_CYCAPTION_ = 4
Const SM_CYBORDER_ = 6
;^^^^^^

; -- Declare globals.
Global window_caption_bar_height = API_GetSystemMetrics( SM_CYCAPTION_ )
Global window_border_height = API_GetSystemMetrics( SM_CYBORDER_ )
Global desktop_screen_width = API_GetSystemMetrics( SM_CXSCREEN_ )
Global desktop_screen_height = API_GetSystemMetrics( SM_CYSCREEN_ )
;^^^^^^

; Set the graphics mode.
Graphics desktop_screen_width, desktop_screen_height - ( window_caption_bar_height * 2 + window_border_height * 3 ), 0, 2

WaitKey ()
End


Comments :


BlackD(Posted 1+ years ago)

 Very nice. :) I was just writing this program and decided to see if anyone else already had. You saved me work. :D