![](/img/trans.png)
[英]How do I press "Enter chill zone button" on the website version of the discord using selenium?
[英]How do I programmatically press Enter?
我有一個C#控制台程序,它啟動計算器並模擬按鍵。 如何以編程方式按Enter鍵 ?
[DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindow(string lpClassName,
string lpWindowName);
// Activate an application window.
[DllImport("USER32.DLL")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
// Send a series of key presses to the Calculator application.
private void StartCalculator()
{
Process.Start("calc.exe");
IntPtr calculatorHandle = FindWindow("CalcFrame","Calculator");
if (calculatorHandle == IntPtr.Zero)
{
return;
}
SetForegroundWindow(calculatorHandle);
SendKeys.SendWait("111");
SendKeys.SendWait("*");
SendKeys.SendWait("11");
SendKeys.SendWait("=");
SendKeys.SendWait(" ");//how press enter?
}
SendKeys.SendWait("~"); // How to press enter?
要么
SendKeys.SendWait("{ENTER}"); // How to press enter?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.