ID: 218
Viewed: 3769
Added: Apr 29, 2002
Version:
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo
Thank you for your vote. Please wait...
It appears you already voted for this snippet
It appears your vote value was empty
This tip demonstrates how you can allow a form to be moved using the mouse without using the title bar. In this example, you can click anywhere on the form and drag it as if you are using the title bar. This code can be useful in conjunction with programs that hide the title bar, i.e. clocks.
Highlight all by clicking in box
<!---Declaration--->
'Declarations
' Add the following code to the declarations section of a form
Private Declare Function SendMessage Lib "User32" _
Alias "SendMessageA" (ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Sub ReleaseCapture Lib "User32" ()
Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2
Highlight All
<!---Code--->
' Add this code to the form's MouseMove procedure:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim lngReturnValue As Long
If Button = 1 Then
Call ReleaseCapture
lngReturnValue = SendMessage(Form1.hWnd, WM_NCLBUTTONDOWN, _
HTCAPTION, 0&)
End If
End Sub;
No Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.