Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Runtime.InteropServices;
- using System.Windows.Forms;
- namespace SendWmKeyup
- {
- public partial class Form1 : Form
- {
- [DllImport("User32.dll")]
- static extern int SendMessage(IntPtr hWnd, uint wMsg, UIntPtr wParam, IntPtr lParam);
- [DllImport("user32.dll", SetLastError = true)]
- public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, IntPtr windowTitle);
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName("notepad");
- IntPtr childHandle = FindWindowEx(p[0].MainWindowHandle, IntPtr.Zero,"Edit", IntPtr.Zero);
- SendMessage(childHandle, (uint)0x0100, (UIntPtr)0x00000041, (IntPtr)(0x001E0001));
- SendMessage(childHandle, (uint)0x0102, (UIntPtr)0x00000061, (IntPtr)(0x001E0001));
- SendMessage(childHandle, (uint)0x0100, (UIntPtr)0x00000041, (IntPtr)(0x401E0001));
- SendMessage(childHandle, (uint)0x0102, (UIntPtr)0x00000061, (IntPtr)(0x401E0001));
- SendMessage(childHandle, (uint)0x0101, (UIntPtr)0x00000041, (IntPtr)(0xC01E0001));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement