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 


VB8 Get Cursor Pos Help

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

Joined: 11 Nov 2007
Posts: 356

PostPosted: Wed May 21, 2008 12:50 pm    Post subject: VB8 Get Cursor Pos Help Reply with quote

Okay ive tried alot of the getcursorpos ive found on google. and all i get from the code is

X:0
Y:0

it never shows me the coordinates

The code i have in a module is.
Code:
    Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (ByVal lpPoint As POINTAPI) As Long
    Dim Rect As POINTAPI
    Structure POINTAPI
        Dim X As Integer
        Dim Y As Integer
    End Structure
    Function GetCPos() As Long
        GetCPos = GetCursorPos(Rect)
    End Function


And the code in my form is.
Code:
   Private Sub GaiaExplorer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Call GetCursorPos(Rect)

        Label3.Text = (".X: = " & Rect.X)
        Label4.Text = ("Y: = " & Rect.Y)

    End Sub

    Private Sub Form_MouseMove(ByVal Button As Integer, _
                        ByVal Shift As Integer, _
                        ByVal X As Single, _
                        ByVal Y As Single)
        Call GetCursorPos(Rect)
        Rect.X = X
        Rect.Y = Y
        Label3.Text = ("x " & Rect.X)
        Label4.Text = ("Y " & Rect.Y)


Can someone tell me what im doing wrong?

_________________
Back to top
View user's profile Send private message
chaosdude3
Advanced Cheater
Reputation: 0

Joined: 20 Mar 2008
Posts: 91

PostPosted: Wed May 21, 2008 2:00 pm    Post subject: Re: VB8 Get Cursor Pos Help Reply with quote

Try this:

Code:

    Private Sub GaiaExplorer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Call GetCursorPos(Rect)

        Label3.Text = (".X: = " & Rect.X)
        Label4.Text = ("Y: = " & Rect.Y)

    End Sub

    Private Sub Form_MouseMove(ByVal Button As Integer, _
                        ByVal Shift As Integer, _
                        ByVal X As Single, _
                        ByVal Y As Single) Handles MyBase.MouseMove
        Call GetCursorPos(Rect)
        Rect.X = X
        Rect.Y = Y
        Label3.Text = ("x " & Rect.X)
        Label4.Text = ("Y " & Rect.Y)
    End Sub

_________________
Final Defense:http://forum.cheatengine.org/viewtopic.php?p=2292273
Caravaneer: http://forum.cheatengine.org/viewtopic.php?t=280224
Ultimate Defense: http://forum.cheatengine.org/viewtopic.php?t=231545
Broken Wings: http://forum.cheatengine.org/viewtopic.php?p=2333206
Back to top
View user's profile Send private message
PhantomLancer
Master Cheater
Reputation: 0

Joined: 11 Nov 2007
Posts: 356

PostPosted: Wed May 21, 2008 8:00 pm    Post subject: Reply with quote

Okay, ive tried that and i got the following error.

it is the mousemove thingy, it is underlined blue.
Code:

    Private Sub Form_MouseMove(ByVal Button As Integer, _
                        ByVal Shift As Integer, _
                        ByVal X As Single, _
                        ByVal Y As Single) Handles MyBase.MouseMove
        Call GetCursorPos(Rect)
        Rect.X = X
        Rect.Y = Y
        Label3.Text = ("x " & Rect.X)
        Label4.Text = ("Y " & Rect.Y)


Method 'Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)' cannot handle event 'Public Event MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs)' because they do not have a compatible signature. C:\Documents and Settings\Compaq_Owner\My Documents\Visual Studio 2008\Projects\Gaia Explorer2.0\Gaia Explorer2.0\GE1.vb

_________________
Back to top
View user's profile Send private message
sumnewdude
Expert Cheater
Reputation: 0

Joined: 23 May 2007
Posts: 181
Location: Where you least expect me.

PostPosted: Wed May 21, 2008 8:23 pm    Post subject: Reply with quote

Umm Iv's seen that before but never tryed it. . . I use this.
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        TextBox1.Text = MousePosition.X()
        TextBox2.Text = MousePosition.Y()
    End Sub

you just need 2 textboxes and a timer . . . .NOTE: Might only work for VB.NET though

_________________

.erutangis ruoy ni siht esu neht ,sdrawkcab siht daer ot hguone trams erew uoy fI
Back to top
View user's profile Send private message
PhantomLancer
Master Cheater
Reputation: 0

Joined: 11 Nov 2007
Posts: 356

PostPosted: Wed May 21, 2008 10:30 pm    Post subject: Reply with quote

sumnewdude wrote:
Umm Iv's seen that before but never tryed it. . . I use this.
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        TextBox1.Text = MousePosition.X()
        TextBox2.Text = MousePosition.Y()
    End Sub

you just need 2 textboxes and a timer . . . .NOTE: Might only work for VB.NET though


woah thanks man it worked... i was trying to do it the hard way lol XP

is there a vb code you know that can click a place on the screen if u put the coordinates in a text box like..

X=1002
Y=94
? if those are in a textbox it will click that spot on the screen?

thanks if u know one

_________________
Back to top
View user's profile Send private message
Typhoon808
Expert Cheater
Reputation: 0

Joined: 27 Mar 2008
Posts: 175
Location: Wales

PostPosted: Thu May 22, 2008 4:56 am    Post subject: Reply with quote

Yeah, just set the MousePosition.X and Y to the positions from the textbox, then simulate a mouseclick (lots of mouseclick code off google).
You might want to make sure the coordinates are numeric and are between your pixel size, too.
Back to top
View user's profile Send private message
sumnewdude
Expert Cheater
Reputation: 0

Joined: 23 May 2007
Posts: 181
Location: Where you least expect me.

PostPosted: Thu May 22, 2008 8:43 pm    Post subject: Reply with quote

Here Ill just post it as a file it keeps on putting a link instead of my post Sad sorry if it makes it harder.


The Extension 'zip' was deactivated by an board admin, therefore this Attachment is not displayed.


_________________

.erutangis ruoy ni siht esu neht ,sdrawkcab siht daer ot hguone trams erew uoy fI
Back to top
View user's profile Send private message
newgirlorder
Expert Cheater
Reputation: 0

Joined: 15 Jan 2008
Posts: 183

PostPosted: Thu May 22, 2008 9:33 pm    Post subject: Reply with quote

Make sure the line that shows the coordinate is in a timer then you can manipulate it to be seen wherever you want.
_________________
Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Fri May 23, 2008 6:53 am    Post subject: Reply with quote

sumnewdude wrote:
Here Ill just post it as a file it keeps on putting a link instead of my post Sad sorry if it makes it harder.

Omg I also had that..... Is the forum hacked or something?
Back to top
View user's profile Send private message
sumnewdude
Expert Cheater
Reputation: 0

Joined: 23 May 2007
Posts: 181
Location: Where you least expect me.

PostPosted: Fri May 23, 2008 7:08 am    Post subject: Reply with quote

tombana wrote:
sumnewdude wrote:
Here Ill just post it as a file it keeps on putting a link instead of my post Sad sorry if it makes it harder.

Omg I also had that..... Is the forum hacked or something?

I don't know but it sure is frustrating . . expecially when you have a loooong post lol

_________________

.erutangis ruoy ni siht esu neht ,sdrawkcab siht daer ot hguone trams erew uoy fI
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