Kinect / PyKinect2

Wrapper to expose Kinect for Windows v2 API in Python
MIT License
496 stars 236 forks source link

sendmessage to pass keyboard to any process that running on my computer #41

Open FarshidAhmadi opened 7 years ago

FarshidAhmadi commented 7 years ago

[DllImport("user32.dll", EntryPoint = "FindWindowEx")] public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); [DllImport("User32.dll")] public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, string lParam);

private void textBox1_TextChanged(object sender, EventArgs e) { Process[] notepadprocess = Process.GetProcessesByName("notepad"); IntPtr child = FindWindowEx(notepadprocess[0].MainWindowHandle, new IntPtr(0), "EDIT", null); SendMessage(child, 0X000C, notepadprocess[0].Id, textBox1.Text); } above codes was good for my textbox1.Text value on my form to a notepad that already running but my Exactly question is : how to use SendMessage in other process INSTEAD OF NOTEPAD

many thanks for cooperations