tags:

views:

39

answers:

1

Hi.

I have a program that simulates mouse click.

Code is something like this:

[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);

        private const int MOUSEEVENTF_LEFTDOWN = 0x02;
        private const int MOUSEEVENTF_LEFTUP = 0x04;

 public static void DoMouseClick(int x, int y)
        {
            Cursor.Position = new Point(x, y);
            mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, x, y, 0, 0);
        }

This code works perfectly. For example I call this function every 30 minutes. But if I press WINKEY+L (Windows is locked) only cursor is moved but not press occurs.

Any ideas?

+3  A: 

The Login screen on windows is designed to NOT allow clicks and automation of UI, as a security feature, IIRC

Chad Ruppert