Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
- static extern IntPtr FindWindowByCaption(int ZeroOnly, string lpWindowName);
- [DllImport("user32.dll", CharSet = CharSet.Auto)]
- static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, int wParam, IntPtr lParam);
- const int WM_KEYDOWN = 0x100;
- //const int WM_KEYUP = 0x101;
- const int L_KEY = 0x4C;
- private void button1_Click(object sender, EventArgs e)
- {
- IntPtr ip = FindWindowByCaption(0, "Untitled - Notepad");
- SendMessage(ip, WM_KEYDOWN, L_KEY, IntPtr.Zero);
- //SendMessage(ip, WM_KEYUP, L_KEY, IntPtr.Zero);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement