-
Oct 16th, 2001, 02:00 AM
#1
Thread Starter
PowerPoster
Enable/disable form resizing at run-time...
How can I enable/disable the ability to resize a form at runtime?
-----------------------------------------
-RJ
rjlohan@alumni.uts.edu.au
-----------------------------------------
-
Oct 16th, 2001, 06:58 AM
#2
Use the RemoveMenu API function.
VB Code:
Private Declare Function GetSystemMenu Lib "User32" _
(ByVal hWnd As Integer, ByVal bRevert As Integer) As Integer
Private Declare Function RemoveMenu Lib "User32" (ByVal hMenu _
As Integer, ByVal nPosition As Integer, ByVal wFlags As Integer) _
As Integer
Const MF_BYPOSITION = &H400
Private Sub Form_Load()
RemoveMenu GetSystemMenu(hWnd, 0), 2, MF_BYPOSITION
End Sub
-
Oct 16th, 2001, 07:01 AM
#3
Actually, here's full code to both enable and disable resizing.
Try this:
VB Code:
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hwnd As Integer, ByVal bRevert As Integer) As _
Integer
Private Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Integer, ByVal nPosition As Integer, _
ByVal wFlags As Integer) As Integer
Const MF_BYPOSITION = &H400
Const MF_APPEND = &H100&
Private Sub Command1_Click()
RemoveMenu GetSystemMenu(hwnd, MF_APPEND), 2, MF_BYPOSITION
End Sub
Private Sub Form_Load()
RemoveMenu GetSystemMenu(hwnd, 0), 2, MF_BYPOSITION
End Sub
-
Oct 16th, 2001, 08:44 PM
#4
Thread Starter
PowerPoster
Probs...
The suggestion you offered MAtthew returns an OVerflow error at Form_Load, and at COmmand1_Click. Why might this be happening?
-----------------------------------------
-RJ
rjlohan@alumni.uts.edu.au
-----------------------------------------
-
Dec 12th, 2001, 08:41 PM
#5
Change "Integer" to "Long" as I have done below and it will work
Private Declare Function GetSystemMenu Lib "User32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "User32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
-
Jul 26th, 2021, 09:00 PM
#6
New Member
Re: Enable/disable form resizing at run-time...
I get a compile coding error with a variable not declared...
BC30451: "hwnd" as not declared. It may be inaccessible due to its
protection level.
How do I correct this?
-
Jul 27th, 2021, 07:30 AM
#7
Re: Enable/disable form resizing at run-time...
Originally Posted by VMcElwee
I get a compile coding error with a variable not declared...
BC30451: "hwnd" as not declared. It may be inaccessible due to its
protection level.
How do I correct this?
You start by not replying to a 20 year old thread. Then you have to understand how to read an API declaration. hwnd relates to a Handle to a WiNDow... so you get the window handle that you want to manipulate, and you pass that in as the hwnd value. It doesn't need to be specifically called hwnd... it could be called qwerty or asdf or windwHandle or what ever.
-tg
-
Dec 23rd, 2021, 06:51 PM
#8
Re: Enable/disable form resizing at run-time...
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
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
|