VB API移动无标题窗体

VB API移动无标题窗体

 

Private Declare Function ReleaseCapture Lib "user32" () As Long
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 Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    If y < 400 Then
        ReleaseCapture
        SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&

              'Or

               ' ReleaseCapture
               '   Call SendMessage(Me.hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0&)
    End If
End Sub
                                                                        
Private Sub Command1_Click()
    Unload Me
End Sub

你可能感兴趣的:(VB API移动无标题窗体)