View Single Post
11-06-2007, 12:46 AM
#1
Nightscream is offline Nightscream
Status: Junior Member
Join date: Aug 2006
Location:
Expertise:
Software:
 
Posts: 58
iTrader: 0 / 0%
 

Nightscream is on a distinguished road

  Old  [VB.NET]Mouse click(coords problems)

What i want to acomplish, to find the coordinates of my screen so like upper left corner is 0,0 but i'm getting proble with it, I want to use the SetCursorPos function later wit the coords that are recorded
I'm using the GetCursorPos function to get the coords
But when i want to see the x and y coords i get something very strange.
x = 1155346203274
y = 0
Now i want to know how can i get this fixed? :s

Code:
Structure PointApi
	Dim x As Long
	Dim y As Long
End Structure

Declare Function GetCursorPos Lib "User32" ( _
		ByRef lpPoint As PointApi) As Long

Private Sub btnPosition_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPosition.Click
Dim pt32 As PointApi

GetCursorPos(pt32)

txtX.Text = pt32.x
txtY.Text = pt32.y