M
M
martensit2019-01-23 08:43:16
C++ / C#
martensit, 2019-01-23 08:43:16

Where is the error in SendMessage to an inactive window?

[DllImport("User32.dll")]
        public static extern void SendMessage(IntPtr hWnd, int uMsg, int wParam);

        public static void Pac()
        {
            System.Threading.Thread.Sleep(2000);
            var dHWnd = FindWindow(null, "Открыть");
            SendMessage(dHWnd, 0x0102, 0x41);
        }

Doesn't send any keystrokes. HWnd - true

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
martensit, 2019-01-23
@martensit

All the same, the wrong HWnd was specified.
For SendMessage, you need to specify the HWnd not of the window itself, but the HWnd of the child field where you want to send a keystroke.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question