Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[VB] How can I drag a frame-less program?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
O-RLY
Expert Cheater
Reputation: 0

Joined: 10 Apr 2007
Posts: 170

PostPosted: Wed Jul 25, 2007 5:11 pm    Post subject: [VB] How can I drag a frame-less program? Reply with quote

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
View user's profile Send private message
Trow
Grandmaster Cheater
Reputation: 2

Joined: 17 Aug 2006
Posts: 957

PostPosted: Wed Jul 25, 2007 6:20 pm    Post subject: Reply with quote

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
View user's profile Send private message
atlantis
Advanced Cheater
Reputation: 0

Joined: 16 Jun 2007
Posts: 69

PostPosted: Thu Jul 26, 2007 1:47 am    Post subject: Reply with quote

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
View user's profile Send private message
Trow
Grandmaster Cheater
Reputation: 2

Joined: 17 Aug 2006
Posts: 957

PostPosted: Thu Jul 26, 2007 2:36 am    Post subject: Reply with quote

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
View user's profile Send private message
O-RLY
Expert Cheater
Reputation: 0

Joined: 10 Apr 2007
Posts: 170

PostPosted: Thu Jul 26, 2007 5:06 am    Post subject: Reply with quote

thanks guys =]
I've already made it lol, but thanks =]
Back to top
View user's profile Send private message
Trow
Grandmaster Cheater
Reputation: 2

Joined: 17 Aug 2006
Posts: 957

PostPosted: Thu Jul 26, 2007 5:13 am    Post subject: Reply with quote

O RLY?
_________________
Get kidnapped often.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites