| View previous topic :: View next topic |
| Author |
Message |
O-RLY Expert Cheater
Reputation: 0
Joined: 10 Apr 2007 Posts: 170
|
Posted: Wed Jul 25, 2007 5:11 pm Post subject: [VB] How can I drag a frame-less program? |
|
|
Hey.
I've made an frame less program.
But its seems like I can't drag it, cause it's got no frame (it's un-moveable),
Does anyone know a code which allows me to drag the program by draging the form itself?
-Someone told me to "override" the program's "WndPrc", and make the system think that every click is on the titlebar.
For real? I got no clue what he's talking about.
Note- The "Moveable" function is enabled (TRUE).
Thanks.
O-RLY.
|
|
| Back to top |
|
 |
Trow Grandmaster Cheater
Reputation: 2
Joined: 17 Aug 2006 Posts: 957
|
Posted: Wed Jul 25, 2007 6:20 pm Post subject: |
|
|
You can use the API-less way (tag X,Y on mousedown, Form move X-oldX,Y-oldY method)
Though I forgot how the API way is declared
_________________
Get kidnapped often. |
|
| Back to top |
|
 |
atlantis Advanced Cheater
Reputation: 0
Joined: 16 Jun 2007 Posts: 69
|
Posted: Thu Jul 26, 2007 1:47 am Post subject: |
|
|
| Code: | 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
Const WM_NCLBUTTONDOWN As Long = &HA1
Const HTCAPTION As Long = 2
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim lngReturnValue As Long
If Button = vbLeftButton Then
Call ReleaseCapture lngReturnValue = SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End If
End Sub
|
|
|
| Back to top |
|
 |
Trow Grandmaster Cheater
Reputation: 2
Joined: 17 Aug 2006 Posts: 957
|
Posted: Thu Jul 26, 2007 2:36 am Post subject: |
|
|
oooo VB code!
| Code: | Dim OldX As Long, OldY As Long
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
OldX = X: OldY = Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then Me.Move Me.Left + X - OldX, Me.Top + Y - OldY
End Sub |
_________________
Get kidnapped often. |
|
| Back to top |
|
 |
O-RLY Expert Cheater
Reputation: 0
Joined: 10 Apr 2007 Posts: 170
|
Posted: Thu Jul 26, 2007 5:06 am Post subject: |
|
|
thanks guys =]
I've already made it lol, but thanks =]
|
|
| Back to top |
|
 |
Trow Grandmaster Cheater
Reputation: 2
Joined: 17 Aug 2006 Posts: 957
|
Posted: Thu Jul 26, 2007 5:13 am Post subject: |
|
|
O RLY?
_________________
Get kidnapped often. |
|
| Back to top |
|
 |
|