Call the GetCursorPos

Khaledinho

Active member
Joined
Jun 22, 2005
Messages
25
Hi all
Please help me
I am trying to call the Windows API function "GetVCursorPos" from the PDA emulator that comes with .NET
I did the dll import and imported the appropriate libraries but i receive the following error:
"Method NotFound Exception"
Please help me
Thanks in advance
 
I dont know if this will help at all, it depends what your trying to achieve. But the Control.PointToScreen() function will turn an application based point into a point relative to the screen.
C#:
		private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			Point pScreenRel = this.PointToScreen(new Point(e.X, e.Y));
		}
 
After doing some research all results points to the fact that GetCursorPosition() only works on devices that actually have a visible cursor. Since a PDA works through a touchscreen and thus has no onscreen cursor, the method does not work correctly.
 
On further research theres another method that might work in the coredll.dll called GetMouseMovePoints().

C#:
		[DllImport("coredll.dll")]

		public static extern bool GetMouseMovePoints( Point[] pptBuf, uint
			nBufPoints, ref uint pnPointsRetrieved );
This is used something like the following (note its not fully tested, but it does seem to return the value).

C#:
		private Point CursorLocation()
		{
			Point[] defPnt = new Point[1];
			uint iRetrieved = 0;
			uint iSize = (uint)defPnt.Length;
			GetMouseMovePoints(defPnt, iSize, ref iRetrieved);

			return defPnt[0];
		}
 
Thanks a lot.
What a bad luck.Look what I found on MSDN documentation for the function
GetMouseMovePoints()
This function is not supported for emulation.
I am very sad.
 
Back
Top