Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Desktop Area/Resize Desktop

Status
Not open for further replies.

NipsMG

Programmer
Dec 27, 2000
215
0
0
US

Hey everybody...

Does anyone know how to resize the desktop area? I saw code on this before and I can't find it.

I'm making a form that docks to the start bar and resizes the desktop so programs don't/can't maximize on top of my program.


Anyone? :)

--NipsMG
 
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

'get handle of taskbar
hwnd = FindWindow(&quot;Shell_Traywnd&quot;, &quot;&quot;)
lRet = SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_SHOWWINDOW)

End Function Joseph Logan
jlogan@softsource.net
 
hmm... maybe SetSystemMetrics?

Not really what i was looking for (actually exactly the opposite :) )...

But thanks anyways, It looks like GetSystemMetrics/SetSystemMetrics is what i'd need to use for this.

--NipsMG
 
Ok maybe not... there is no SetSystemMetrics.. :)

--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...


--NipsMG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top