C#调用记事本并填写内容
Posted 朝闻道
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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#调用记事本并填写内容的主要内容,如果未能解决你的问题,请参考以下文章