Wednesday, July 1, 2009

Move form without title bar on VB6

If form without titlebar, possible we cannot move the form. To be able to move form without titlebar, inserting code following, but previously make form without titlebar by assigning value Borderstyle at form properties 0 or NONE.

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" ()
Private Const HTCAPTION = 2

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(Me.hWnd, WM_NCLBUTTONDOWN, _
End If
End Sub

Now, try to move your form.

No comments:

Post a Comment