|
-
Apr 5th, 2000, 06:57 AM
#1
Thread Starter
Junior Member
How can i disable users from resizing (stretching) a window??
What API function call do i need to make??
Can i use SetWindowLong() api call since i am already using that for disabling the Maximize button??
-
Apr 5th, 2000, 07:06 AM
#2
Fanatic Member
Set your borders to "NONE" for your forms.
If using API, use SetWindowPos with the lastparameter as NO_Size.
The No_Size should be a constant, if you look up in the API viewer.
Chemically Formulated As:
Dr. Nitro
-
Apr 5th, 2000, 07:16 AM
#3
Thread Starter
Junior Member
Its an MDI form so there is no borderstyle property... & also i did use the SW_NOSIZE constant as the last parameter in the setwindowpos api function call....
I can still resize it even after this....
Any other suggestions??
-
Apr 5th, 2000, 07:23 AM
#4
Fanatic Member
During the form_Load or form_Activate, set it a certain size. Assing the width and height to variables. In your form_resize, reassign these variables to me.width and me.height
That is the only other way I know. Yes, it is the cheating's man way.
I will try to think of something more professional in the mean time.
BTW...
Keep the variables on a module level not a prodcedural level. Meaning Dim the variables in the declaration.
[Edited by Nitro on 04-05-2000 at 08:25 PM]
Chemically Formulated As:
Dr. Nitro
-
Apr 8th, 2000, 09:40 PM
#5
Addicted Member
What is SetWindowLong() - I have the same prob with resizing
-
Apr 9th, 2000, 01:00 AM
#6
Addicted Member
arif,
please could you send me the code for disabling the Maximize button. I will look out for the thing that stops people stretching a window
Thanks#
Richard Charlton
-
Apr 9th, 2000, 01:13 AM
#7
Junior Member
RCharlton, there is no code for the Maximize button, all you have to do is disable it in the Properties window of the form (MaxButton to False) at design time
-
Apr 9th, 2000, 07:16 AM
#8
Thread Starter
Junior Member
Wrong Info on this thread
Although u can set the maxbutton property to false at design time, this only works with NON-MDI forms....for your MDI forms u have to do it in code using windows API functions....i looked up several in the API text viewer & the code below will show how to disable the Maximize button on an MDI form & also how to prevent resizing:
Code:
-----
In the General declartions of a Module
----------------------------------------
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const WS_THICKFRAME = &H40000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const GWL_STYLE = (-16)
'This function will make sure the form that is passed to it
' thru its paramater has the Maximize button disabled & cannot
' be resized
Public Sub MaxBox(ByRef PsdForm As Form)
Dim lStyle As Long
lStyle = GetWindowLong(PsdForm.hwnd, GWL_STYLE)
lStyle = lStyle Xor WS_MAXIMIZEBOX Xor WS_THICKFRAME
Call SetWindowLong(PsdForm.hwnd, GWL_STYLE, lStyle)
End Sub
In the Load Event of the MDI form:
----------------------------------
Maxbox Me
-
Apr 9th, 2000, 02:51 PM
#9
Addicted Member
Is there a way of having a maximise button disabled,
a minimize button AND no stretching?
Thanks
Richard Charlton
-
Apr 9th, 2000, 07:20 PM
#10
Member
Simply change borderstyle to 0-NONE from 2-Sizable
-
Apr 9th, 2000, 11:23 PM
#11
New Member
Not on an MDI form though.
-
Oct 2nd, 2000, 01:06 PM
#12
Addicted Member
MaxBox problem
Originally posted by arif
Although u can set the maxbutton property to false at design time, this only works with NON-MDI forms....for your MDI forms u have to do it in code using windows API functions....i looked up several in the API text viewer & the code below will show how to disable the Maximize button on an MDI form & also how to prevent resizing:
Code:
-----
In the General declartions of a Module
----------------------------------------
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const WS_THICKFRAME = &H40000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const GWL_STYLE = (-16)
'This function will make sure the form that is passed to it
' thru its paramater has the Maximize button disabled & cannot
' be resized
Public Sub MaxBox(ByRef PsdForm As Form)
Dim lStyle As Long
lStyle = GetWindowLong(PsdForm.hwnd, GWL_STYLE)
lStyle = lStyle Xor WS_MAXIMIZEBOX Xor WS_THICKFRAME
Call SetWindowLong(PsdForm.hwnd, GWL_STYLE, lStyle)
End Sub
In the Load Event of the MDI form:
----------------------------------
Maxbox Me
The problem I find with this is that there is a blue/yellow border around the ourside of the window, belown the title bar. Why does this happen and can I stop it?
Thanks
-
Oct 2nd, 2000, 03:04 PM
#13
Try this.
Code:
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
Private Const MF_BYPOSITION = &H400&
Private Sub Form_Load()
RemoveMenu GetSystemMenu(hwnd, 0), 2, MF_BYPOSITION
End Sub
-
Oct 3rd, 2000, 02:34 AM
#14
Addicted Member
Thanks Megatron, but it still does not seem to work
If you would like I will post a screenshot of it on the net so u can see the problem. Please reply if you want to see it.
Richard Charlton
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
|