by Nokiocab25 (3 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sat 5th July 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Make your form cover the entire screen a.k.a fullscreen mode
API Declarations
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_NOZORDER = &H4
Private Const SWP_SHOWWINDOW = &H40
Private Const HWND_TOP = 0
Private Const BORDER_NONE = 0
Private Declare Function GetDesktopWindow Lib "user32.dll" () As Long
Private Declare Function GetClientRect Lib "user32" _
(ByVal hWnd As Long, lpRect As RECT) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, _
ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
' Have A Border
Private Sub EnableFullScreen(frmObject As Form)
Dim hRect As RECT
frmObject.BorderStyle = BORDER_NONE
frmObject.WindowState = vbNormal
Call GetClientRect(GetDesktopWindow, hRect)
Call SetWindowPos(frmObject.hWnd, HWND_TOP, 0&, 0&, _
hRect.Right, hRect.Bottom, _
SWP_NOZORDER Or SWP_NOACTIVATE Or SWP_SHOWWINDOW)
End Sub