Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: RhiNo on December 19, 2002, 11:41 AM

Title: help move? please
Post by: RhiNo on December 19, 2002, 11:41 AM
can someone help me on moving a freakin form without title bar n what not cause i am workin on bot and thats next thing that need to be done any help would be appreciated
Title: Re: help move? please
Post by: Spht on December 19, 2002, 01:55 PM
That sounds fun!

First, add this to your project source:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long

Just some Win32 API functions you'll need for doing this.

Now, you may want to make a function that actually does the moving of the form...

Private Sub MoveForm(frmForm As Form)
    Dim lngRetVal As Long
    
    ReleaseCapture
    lngRetVal = SendMessage(frmForm.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End Sub

Now, create a _MouseDown() event for where you want to click to drag the form. If you want to click the form to do it, then Form_MouseDown(). In here, choose whatever button you want to required to be clicked (idealy left-click) and then call MoveForm().
Title: Re: help move? please
Post by: Grok on December 20, 2002, 01:30 AM
You didn't specify how you wanted the form to move.  Due to a user clicking on the form and dragging?  Are you providing your own 'caption' bar and wanting that to be the drag-move substitute?
Title: Re: help move? please
Post by: RhiNo on December 21, 2002, 10:49 AM
yea i woulda said thanx earlier but i been sick and still am sorta but thanx