首页 > 代码库 > C#调用记事本并填写内容
C#调用记事本并填写内容
using System.Runtime.InteropServices;
using System.Diagnostics;
[DllImport("User32.DLL")]
public static extern int SendMessage(IntPtr hWnd,
uint Msg, int wParam, string lParam);
[DllImport("User32.DLL")]
public static extern IntPtr FindWindowEx(IntPtr hwndParent,
IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
public const uint WM_SETTEXT = 0x000C;
private void button1_Click(object sender, EventArgs e)
{
Process vProcess = Process.Start("notepad.exe");
while (vProcess.MainWindowHandle == IntPtr.Zero) vProcess.Refresh();
IntPtr vHandle = FindWindowEx(vProcess.MainWindowHandle,
IntPtr.Zero, "Edit", null);
SendMessage(vHandle, WM_SETTEXT, 0, "Zswang 路过");
}
http://blog.csdn.net/zswang/article/details/1543956
C#调用记事本并填写内容
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。