|
-
Sep 19th, 2003, 07:09 AM
#1
Thread Starter
Frenzied Member
SendMessage Lib "User32" Alias "SendMessageA" in VB.net? [resolved]
This api call should move the form around. even if it is borderless (what mine is).. any suggestions on how to do this with the below code OR with other code?
I am wondering how i can use similar code or this code in vb.net
i doesnt seem to work at all.
VB Code:
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" ()
Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2
Private Sub Picture1_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, HTCAPTION, 0&)
End If
End Sub
this is the code i used in vb6.. but in lParam As Any gives : Any is not supported bug..
Last edited by Ultimasnake; Sep 19th, 2003 at 07:49 AM.
-
Sep 19th, 2003, 07:32 AM
#2
There's a class for moving a captionless form in VB.net on this site...
-
Sep 19th, 2003, 07:35 AM
#3
Sleep mode
Or use this code :
VB Code:
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private Const WM_NCLBUTTONDOWN As Integer = &HA1
Private Const HTCAPTION As Integer = 2
Public Sub New()
Me.Text = "Drag anywhere to move"
AddHandler Me.MouseDown, AddressOf frmMain_MouseDown
End Sub
Private Sub frmMain_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
'Don't drag the sceen if it is the right button or the wheel.
If e.Button = MouseButtons.Left Then
ReleaseCapture()
SendMessage(Me.Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End If
End Sub
-
Sep 19th, 2003, 07:47 AM
#4
Thread Starter
Frenzied Member
Thanks guys...
i am using the one from pirate
its like my code but fixed :P
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|