Khaledinho Posted November 17, 2005 Posted November 17, 2005 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 Quote Life is the biggest school
Cags Posted November 17, 2005 Posted November 17, 2005 I don't 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. private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { Point pScreenRel = this.PointToScreen(new Point(e.X, e.Y)); } Quote Anybody looking for a graduate programmer (Midlands, England)?
Khaledinho Posted November 17, 2005 Author Posted November 17, 2005 Hello This is not all useful. Look i want to get the color of the pixel the mouse clicks Quote Life is the biggest school
Cags Posted November 17, 2005 Posted November 17, 2005 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. Quote Anybody looking for a graduate programmer (Midlands, England)?
Cags Posted November 17, 2005 Posted November 17, 2005 On further research theres another method that might work in the coredll.dll called GetMouseMovePoints(). [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). private Point CursorLocation() { Point[] defPnt = new Point[1]; uint iRetrieved = 0; uint iSize = (uint)defPnt.Length; GetMouseMovePoints(defPnt, iSize, ref iRetrieved); return defPnt[0]; } Quote Anybody looking for a graduate programmer (Midlands, England)?
Khaledinho Posted November 17, 2005 Author Posted November 17, 2005 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. Quote Life is the biggest school
Recommended Posts