【发布时间】:2021-03-07 16:38:03
【问题描述】:
我搜索了互联网和论坛,但找不到如何做。我想要做的是每 5 分钟在不和谐聊天中发送一条文本。我想从我的帐户发送它,所以我想编写一个简单的控制台应用程序,它只输出文本并输入到另一个程序。 我尝试了 sendInput 类,但没有让它工作。
[DllImport("user64.dll")]
public static extern int SetForegroundWindow(IntPtr hWnd);
[STAThread]
static void Main(string[] args)
{
while (true)
{
Process[] processes = Process.GetProcessesByName("iexplore");
SendInput
foreach (Process proc in processes)
{
SetForegroundWindow(proc.MainWindowHandle);
SendKeys.
}
Thread.Sleep(5000);
}
}
我该怎么做?
【问题讨论】:
-
你试过了吗? [DllImport("user32.dll")] public static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);