'Constants
Const HTCAPTION = &H2
Const WM_NCLBUTTONDOWN = &HA1
'API functions
<DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True, ExactSpelling:=True)> _
Public Shared Function ReleaseCapture() As Boolean
End Function
Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
'You could Dock a Panel to the top of your form and use:
Private Sub Panel1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
'This code can be used in the MouseDown event of any control(s) you want to be able to move your form with
ReleaseCapture()
SendMessage(Me.Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End Sub
then call your groovy new dllimported function from your mousedown event handler that you need to create. clear as mud? and someone will have to help me with the constants I believe your &h1 is 0x01 and &HA1 is 0xA1
Please be specific about what you need: Do you want this in C++ or C++/CLI? Because that could make a difference.
I don't know C++/CLI, but I THINK you don't need to P/Invoke Windows functions. You can use them directly just like in regular unmanaged C++ simply by #including the appropriate Windows header.