View previous topic :: View next topic |
Author |
Message |
PhantomLancer Master Cheater
Reputation: 0
Joined: 11 Nov 2007 Posts: 356
|
Posted: Wed May 21, 2008 12:50 pm Post subject: VB8 Get Cursor Pos Help |
|
|
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 |
|
 |
chaosdude3 Advanced Cheater
Reputation: 0
Joined: 20 Mar 2008 Posts: 91
|
Posted: Wed May 21, 2008 2:00 pm Post subject: Re: VB8 Get Cursor Pos Help |
|
|
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
|
_________________
|
|
Back to top |
|
 |
PhantomLancer Master Cheater
Reputation: 0
Joined: 11 Nov 2007 Posts: 356
|
Posted: Wed May 21, 2008 8:00 pm Post subject: |
|
|
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 |
|
 |
sumnewdude Expert Cheater
Reputation: 0
Joined: 23 May 2007 Posts: 181 Location: Where you least expect me.
|
Posted: Wed May 21, 2008 8:23 pm Post subject: |
|
|
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 |
|
 |
PhantomLancer Master Cheater
Reputation: 0
Joined: 11 Nov 2007 Posts: 356
|
Posted: Wed May 21, 2008 10:30 pm Post subject: |
|
|
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 |
|
 |
Typhoon808 Expert Cheater
Reputation: 0
Joined: 27 Mar 2008 Posts: 175 Location: Wales
|
Posted: Thu May 22, 2008 4:56 am Post subject: |
|
|
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 |
|
 |
sumnewdude Expert Cheater
Reputation: 0
Joined: 23 May 2007 Posts: 181 Location: Where you least expect me.
|
|
Back to top |
|
 |
newgirlorder Expert Cheater
Reputation: 0
Joined: 15 Jan 2008 Posts: 183
|
Posted: Thu May 22, 2008 9:33 pm Post subject: |
|
|
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 |
|
 |
tombana Master Cheater
Reputation: 2
Joined: 14 Jun 2007 Posts: 456 Location: The Netherlands
|
Posted: Fri May 23, 2008 6:53 am Post subject: |
|
|
sumnewdude wrote: | Here Ill just post it as a file it keeps on putting a link instead of my post sorry if it makes it harder. |
Omg I also had that..... Is the forum hacked or something?
|
|
Back to top |
|
 |
sumnewdude Expert Cheater
Reputation: 0
Joined: 23 May 2007 Posts: 181 Location: Where you least expect me.
|
Posted: Fri May 23, 2008 7:08 am Post subject: |
|
|
tombana wrote: | sumnewdude wrote: | Here Ill just post it as a file it keeps on putting a link instead of my post 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 |
|
 |
|