Kyl*_*ndo 14
按窗口名称:
[DllImport("User32.dll")]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("User32.dll")]
static extern int SetForegroundWindow(IntPtr hWnd);
IntPtr ptrFF = FindWindow(null, "Mozilla Firefox");
SetForegroundWindow(ptrFF);
SendKeys.SendWait("{F1}");
Run Code Online (Sandbox Code Playgroud)
按流程名称:
Process proc = Process.GetProcessesByName("firefox")[0];
IntPtr ptrFF = proc.Handle;
SetForegroundWindow(ptrFF);
SendKeys.SendWait("{F1}");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13783 次 |
| 最近记录: |