Click to See Complete Forum and Search --> : how to manually drag the form???


ilynx
October 19th, 2001, 10:09 PM
how can i manually drag the form??? i disabled my title bar therefore i must manually set my dragging codes. can anyone help me???

John G Duffy
October 20th, 2001, 01:01 PM
Here is a sample to drag forms without title bars
Start a new project. Add a module
Paste this code in the appropriate spots.
Run the program and Click and hold the mouse button and move it around the screen.

'
' paste this code in the Module
'
Declare Sub ReleaseCapture Lib "user32" ()
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (byval hwnd as Long, byval wMsg as Long, byval wParam as Integer, byval lParam as Long) as Long

public Sub FormDrag(TheForm as Form)
ReleaseCapture
Call SendMessage(TheForm.hwnd, &HA1, 2, 0&)
End Sub
'
' Paste this code into the from
'
private Sub Form_MouseDown(Button as Integer, Shift as Integer, X as Single, Y as Single)

FormDrag me

End Sub




John G

Andrex
September 22nd, 2003, 09:30 PM
That code works great.

Now that we are on the topic, is there some way to show the form in taskbar with certain title, while the form does not have the titlebar? (because it has no caption)... it is a paradox I guess. :D