Hi:
Below is the function I use to cover the entire screen with my form or whatever. I know it seems iverkill, but you need to do it this we to make it work across platforms.
First you need to declare the following:
Private Const SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1
Private Const SWP_SHOWWINDOW = &H40
Private Const SW_NORMAL = 1
Private Const HWND_TOP = 0
Private Const HWND_BOTTOM = 1
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) 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
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
*******************************************************
'Hides the taskbar by ensuring that the form populates the entire screen
Public Function HideTaskBar(hwnd As Long) As Long
Dim cx As Long
Dim cy As Long
Dim lRet As Long
Dim lRes As Long
' Get full screen width.
cx = GetSystemMetrics(SM_CXSCREEN)
' Get full screen height.
cy = GetSystemMetrics(SM_CYSCREEN)
'cannot be maximized when covering screen
If hwnd <> 0 Then
lRet = ShowWindow(hwnd, SW_NORMAL)
End If
If hwnd <> 0 Then
lRet = SetWindowPos(hwnd, HWND_TOP, 0, 0, cx, cy, _
SWP_SHOWWINDOW)
End If
--Anyone else on this?? I don't need to take up the whole screen.. I'm adding another toolbar docked to the top of the Taskbar, and I want to resize the desktop so that windows only maximize down as far as the top of my app, instead of the top of the Taskbar...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.