|
-
Sep 12th, 2000, 08:50 AM
#1
Thread Starter
PowerPoster
Megatron helped with the min, max, x disabling. Thanks.
Is there a way to stop the user from resizing?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 12th, 2000, 02:58 PM
#2
Remove the Size commmand like you did with the rest.
Code:
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Sub Form_Load()
RemoveMenu GetSystemMenu(hwnd, 0), 2, MF_BYPOSITION
End Sub
-
Sep 12th, 2000, 03:09 PM
#3
Lively Member
I tryed Megatron's code in Windows 2000 with VB6 sp4 and I could NOT stop the form to maximize if I dbl-click on the titlebar. sorry
Code:
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Sub Form_Load()
RemoveMenu GetSystemMenu(hwnd, 0), 2, MF_BYPOSITION
End Sub
-
Sep 12th, 2000, 03:16 PM
#4
That because the above example will stop the user from resizing the Form. If you want to prevent them from maximizing the Form, use the following code.
Code:
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Sub Form_Load()
RemoveMenu GetSystemMenu(hwnd, 0), 4, MF_BYPOSITION
End Sub
-
Sep 12th, 2000, 03:36 PM
#5
Thread Starter
PowerPoster
Gentlemen, first thanks for you responses.
I just wanted to explain things better. I have a MDIform that is maximized on startup. I have disabled the min,restore, and x button. Double clicking on titlebar resizes and that is the problem.
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 12th, 2000, 03:53 PM
#6
The code I gave above should fix the problem.
-
Sep 12th, 2000, 11:49 PM
#7
Lively Member
Megatron - Yeah.. Now I see.. and it works.. great!
-
Oct 19th, 2000, 01:33 AM
#8
Frenzied Member
Disable Maximize Button
Megatron, the maximize button will not function, true.
However, it is not grayed out. This looks better and is not confusing. Lets the user know it is disabled.
-
Oct 21st, 2000, 01:00 AM
#9
Here is how to keep a form/mdiform from being resized:
Code:
'Author: Megatron
'Origin: http://forums.vb-world.net/showthread.php?postid=91647
'Purpose: Keep a form from being resized.
'Version: VB4+
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
Dim LockWindow As Boolean
Dim iWidth As Integer
Dim iHeight As Integer
Private Sub MDIForm_Load()
'Save the initial dimensions
iWidth = Me.Width
iHeight = Me.Height
End Sub
Private Sub MDIForm_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
LockWindowUpdate 0&
End Sub
Private Sub MDIForm_Resize()
On Error Resume Next
Static FirstLoad
'If this is the First time the Window is loading then don't lock it
If FirstLoad = False Then
FirstLoad = True
LockWindow = True
Exit Sub
End If
'Lock the Window when the User tries to resize it
If LockWindow = True Then
'Restore the dimensions
Me.Width = iWidth
Me.Height = iHeight
LockWindowUpdate Me.hWnd
End If
End Sub
-
Oct 21st, 2000, 09:52 AM
#10
With simple API, using LockWindowUpdate is not necessary, however, that method is good if you don't want the menu completely reomved.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|