|
-
Sep 12th, 2000, 10:11 AM
#1
Thread Starter
PowerPoster
Kinda going back to my original question.
How can you detect that the user has doubleclicked on the titlebar of a mdiform? I need to disable the resizing...
Please help !!!
I have used on the resize event of the MDIform:
windowstate=vbmaximized
but it kinda look crappy.
Any suggestions?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 12th, 2000, 11:27 AM
#2
Thread Starter
PowerPoster
Anyone Please?
Does anyone have any ideas?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 12th, 2000, 12:52 PM
#3
Thread Starter
PowerPoster
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 12th, 2000, 03:08 PM
#4
This will disable everything
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()
For I = 0 To 7
RemoveMenu GetSystemMenu(hwnd, 0), 0, MF_BYPOSITION
Next I
End Sub
-
Sep 12th, 2000, 03:21 PM
#5
OK, if you just don't want the form to be maximized when the user double clicks on the title bar you have to sub class the form.
Code:
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 CallWindowProc _
Lib "user32" Alias "CallWindowProcA" ( _
ByVal lpPrevWndFunc As Long, _
ByVal hwnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Const GWL_WNDPROC = (-4)
Private Const WM_NCLBUTTONDBLCLK = &HA3
Private Const WM_LBUTTONUP = &H202
Private Const HTCAPTION = 2
Private Const WM_DESTROY = &H2
Private lngHwnd As Long
Private lngPrevWndProc As Long
Public Sub HookForm(frm As Form)
lngHwnd = frm.hwnd
lngPrevWndProc = SetWindowLong(lngHwnd, GWL_WNDPROC, AddressOf WinProc)
End Sub
Public Sub UnhookForm()
SetWindowLong lngHwnd, GWL_WNDPROC, lngPrevWndProc
End Sub
Public Function WinProc( _
ByVal hw As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Select Case uMsg
Case WM_NCLBUTTONDBLCLK
If wParam = HTCAPTION Then
uMsg = WM_LBUTTONUP
End If
Case WM_DESTROY
'the window has been closed
UnhookForm
End Select
WinProc = CallWindowProc(lngPrevWndProc, hw, uMsg, wParam, lParam)
End Function
To enable this from your form add the following code in the MDIForm_Load event
Code:
Private Sub MDIForm_Load()
HookForm Me
End Sub
Good luck!
-
Apr 29th, 2002, 11:28 AM
#6
Thread Starter
PowerPoster
WELL
MAN, I know this is old, but I never have gotten it to work. Anybody have any suggestions?
I have the min, max and close button disbaled, but user can still resize if the double-click on the titlebar of the form...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Apr 29th, 2002, 11:40 AM
#7
Frenzied Member
You can do this with the EventVB.dll thus:
VB Code:
Option Explicit
Dim WithEvents vbLink As EventVB.APIFunctions
Dim WithEvents vbWnd As EventVB.ApiWindow
Private Sub Form_Load()
Set vbLink = New EventVB.APIFunctions
Set vbWnd = New EventVB.ApiWindow
vbWnd.hWnd = Me.hWnd
'\\ Subclass this form....
vbLink.SubclassedWindows.Add vbWnd
End Sub
Private Sub vbWnd_MinMaxSize(MaxHeight As Long, MaxWidth As Long, MaxPositionTop As Long, MaxPositionLeft As Long, MinTrackWidth As Long, MinTrackheight As Long, MaxTrackWidth As Long, MaxTrackHeight As Long)
If Me.WindowState <> vbMinimized Then
With vbWnd.RECT
MaxHeight = .Bottom - .Top
MaxWidth = .Right - .Left
MaxPositionLeft = .Left
MaxPositionTop = .Top
End With
End If
End Sub
Hope this helps,
Duncan
-
Apr 29th, 2002, 11:47 AM
#8
Thread Starter
PowerPoster
Well
MerrionComputin : Thanks for your reply. I will try out the dll and see if I cn get it to work. Thansk for the reply to such an old post...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Apr 29th, 2002, 11:53 AM
#9
Thread Starter
PowerPoster
Well - I'll be damned
MerrionComputin : It work exactly the way I wanted it to...
Bad ass dll. Your design?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Apr 29th, 2002, 12:03 PM
#10
Frenzied Member
Bad ass dll. Your design?
My magnum opus - cruelly cut short by the rest of the world moving to VB.Net
-
Apr 29th, 2002, 12:18 PM
#11
Thread Starter
PowerPoster
Well
Let move to NET. Right now 6.0 works for me...
Thanks again.
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
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
|