Haytham
12-26-2001, 01:35 PM
Hi All...
My startup form is maximixed to full screen.
How can I hide Maximise, Minimise and Close Button from the TitleBar of the screen.
If the form is Dialog one, that can be removed th' Properties of the form. But how about when form is Maximised...
Hope to find help from you programmers
Thanks in advance
Set the forms pop up to yes.
HTH
Haytham
12-27-2001, 02:31 PM
Hi Rich,
PopUp will hide Max/Min but not Close Box X
My form is maximizes.
I have a code but don't know how to execute it. It's as follows:
'This code was originally written by Terry Kreft.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code courtesy of
'Terry Kreft
'
Type Rect
x1 As Long
y1 As Long
x2 As Long
y2 As Long
End Type
Declare Function IsZoomed Lib "user32" (ByVal hWnd As Long) As Long
Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal _
nCmdShow As Long) As Long
Declare Function MoveWindow Lib "user32" (ByVal hWnd As Long, ByVal _
X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight _
As Long, ByVal bRepaint As Long) As Long
Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long
'Use following instead of GetWindowRect
Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect _
As Rect) As Long
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOWNORMAL = 1
Sub MaximizeRestoredForm(F As Form)
Dim MDIRect As Rect
' If the form is maximized, restore it.
If IsZoomed(F.hWnd) <> 0 Then
ShowWindow F.hWnd, SW_SHOWNORMAL
End If
' Get the screen coordinates and window size of the
' MDIClient area.
'This is the line which is different
GetClientRect GetParent(F.hWnd), MDIRect
' Move the form to the upper left corner of the MDIClient
' window (0,0) and size it to the same size as the
' MDIClient window.
MoveWindow F.hWnd, 0, 0, MDIRect.x2 - MDIRect.x1, MDIRect.y2 - MDIRect.y1, True
End Sub
Will you help me in this code please
I don't understand why you want to use this code, if the form is set to pop up and maximise it will cover the entire window anyway. Although the close button still appears it shouldn't be enabled, if you don't want to see the close button set the border to none, add a label to the form header which contains the forms caption if you want the caption displayed.