Hi, I m using SetCursorPos() in my project!

  [DllImport("user32.dll")]
        static extern bool SetCursorPos(int X, int Y);

I want to use double value in the function? I m getting error PinvokeStackImbalance was detected.
How to solve this?

Recommended Answers

All 2 Replies

Unless I'm mistaken it only accepts ints as the parameter values. Why do you need to pass it a float?

Is the built-in SetCursorPosition() not acceptable?

using System;

namespace DW_418958_CS_CON
{
   class Program
   {
      static void Main(string[] args)
      {
         Console.SetCursorPosition(20, 10);
         Console.ReadLine();
      }
   }
}

...but since the positions on the screen are whole numbers, only whole numbers would make sense.
If I had originated this method, it would take only unsigned short for both parameters, since negative numbers don't make sense.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.