Custom TitleBar


'Code By Kiran.
'Custom TitleBar
'Following code converts your label in to your form's titlebar.
'Add a label called lbltool on to your form.

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

'Label mouse down event
Private Sub lbltool_MouseDown(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, HTCAPTION, 0&wink
End If
End Sub
You can view this article online at:
http://www.kiranreddys.com/knowledgebase/index.php/article/custom-titlebar