User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 401,571 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,368 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 35069 | Replies: 8
Reply
Join Date: Sep 2004
Posts: 2
Reputation: vbpro is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
vbpro vbpro is offline Offline
Newbie Poster

Help How can I get Mouse Position?

  #1  
Sep 28th, 2004
How can I get the Mouse Position from the mousemove event inthe VB.net?

I can't find out how to do this.. :rolleyes:
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2004
Posts: 2
Reputation: Mr.Stupid is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Mr.Stupid Mr.Stupid is offline Offline
Newbie Poster

Re: How can I get Mouse Position?

  #2  
Oct 18th, 2004
Originally Posted by vbpro
How can I get the Mouse Position from the mousemove event inthe VB.net?

I can't find out how to do this.. :rolleyes:



  Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove

        Label1.Text = "X." & e.X & vbCrLf & "Y." & e.Y
        
    End Sub 
Reply With Quote  
Join Date: Jul 2007
Posts: 1
Reputation: Benuz is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Benuz Benuz is offline Offline
Newbie Poster

Question Re: How can I get Mouse Position?

  #3  
Jul 5th, 2007
Originally Posted by Mr.Stupid View Post
  Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove

        Label1.Text = "X." & e.X & vbCrLf & "Y." & e.Y
        
    End Sub 

hi,
but these code above only works inside the form.

how to get the mouse coordinates / position by using VB2005.NET in anywhere?
Reply With Quote  
Join Date: Mar 2007
Posts: 21
Reputation: iTaChi is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
iTaChi's Avatar
iTaChi iTaChi is offline Offline
Newbie Poster

Re: How can I get Mouse Position?

  #4  
Jul 16th, 2007
you cant get the coordinates of the pointer outside the form..

if you wish to.. customize windows!! :lol:
"If you understand, you can learn anything"


http://www.cprogrammingdock.serverspeople.net
Reply With Quote  
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation: jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough 
Rep Power: 30
Solved Threads: 268
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Microsoft Fanboy

Re: How can I get Mouse Position?

  #5  
Jul 16th, 2007
you would need to use DirectX or something for that
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
Reply With Quote  
Join Date: Feb 2007
Location: Bangalore,India
Posts: 1,213
Reputation: debasisdas is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 78
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Nearly a Posting Virtuoso

Re: How can I get Mouse Position?

  #6  
Jul 19th, 2007
do you want to trap mouse co-ordinates any where on the screen ?
Share your Knowledge.
Reply With Quote  
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation: jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough 
Rep Power: 30
Solved Threads: 268
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Microsoft Fanboy

Re: How can I get Mouse Position?

  #7  
Jul 19th, 2007
yes
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
Reply With Quote  
Join Date: Jul 2007
Location: Denmark
Posts: 1
Reputation: Skullmagic is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Skullmagic's Avatar
Skullmagic Skullmagic is offline Offline
Newbie Poster

Solution Re: How can I get Mouse Position?

  #8  
Jul 25th, 2007
Dim MyPointAPI As POINTAPI
Private Type POINTAPI
  X As Long
  Y As Long
End Type

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Public Sub Timer1_Timer()
  l = GetCursorPos(MyPointAPI)
  Label1.Caption = CStr(MyPointAPI.X) & ", " & CStr(MyPointAPI.Y)
End Sub
Last edited by Skullmagic : Jul 25th, 2007 at 4:38 am. Reason: Don't look good!!!
Reply With Quote  
Join Date: Jul 2007
Posts: 24
Reputation: blondie.simon is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
blondie.simon blondie.simon is offline Offline
Newbie Poster

Re: How can I get Mouse Position?

  #9  
Jul 25th, 2007
I have not been using VB for very long but this is how I have been getting the mouse postion on the screen.

 Dim MousePosition As Point
        MousePosition = Cursor.Position

I hope this helps
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 4:01 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC