Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

moving a form without title bar

Status
Not open for further replies.

Basif

Programmer
Jul 28, 2001
1
IN
hi,
How to move a form (during run time ) which does not have a title bar.It does not
have any buttons at top right corner.

 
'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'After you Copy&Paste the following code to your form, You will be able to move it by
'clicking on it and holding the mouse button down (like WinAmp).
'Insert this code to the module :

Declare Function SendMessage Lib "User32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam _
As Long, lParam As Any) As Long
Declare Sub ReleaseCapture Lib "User32" ()
Public Const WM_NCLBUTTONDOWN = &HA1
Public Const HTCAPTION = 2

'Insert this code to your form:

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim ReturnValue As Long
If Button = 1 Then
Call ReleaseCapture
ReturnValue = SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End If
End Sub


Eric De Decker
vbg.be@vbgroup.nl

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top