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 路过");
}

相关文章:

  • 2021-12-15
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-14
  • 2022-12-23
  • 2021-06-10
  • 2021-11-10
  • 2021-09-12
相关资源
相似解决方案