开发者

How can I express this VB code in C#?

开发者 https://www.devze.com 2023-02-25 06:24 出处:网络
How can I convert this from vb to c#? Call WshShell.Run( \"API_CALLBACK.exe\", 0, True ) WScript.Slee开发者_JAVA百科p(10000)

How can I convert this from vb to c#?

 Call WshShell.Run( "API_CALLBACK.exe", 0, True )  
 WScript.Slee开发者_JAVA百科p(10000)  

 WshShell.SendKeys("{ENTER}")  
 WScript.Sleep(3000)  
 WshShell.SendKeys("%S")  
 WScript.Sleep(3000)  
 WshShell.SendKeys("%Y")  

Thx

It is process.start("API_CALLBACK");? how to do with .sendkey?


I'm not going to write the code for you, but here are the things you'll need:

One way to star a process in .NET is the Process.Start method. You'll have to look for the overload the does what you need it to.

Process.Start("API_CALLBACK.exe");

There is also a handy SendKeys class in the .NET framework.

SendKeys.Send("{ENTER}");

And further, you can put the current thread to sleep with the Thread.Sleep method.

Thread.Sleep(1000);


WshShell.Run("API_CALLBACK.exe", 0, true);
WScript.Sleep(10000);

WshShell.SendKeys("{ENTER}");
WScript.Sleep(3000);
WshShell.SendKeys("%S");
WScript.Sleep(3000);
WshShell.SendKeys("%Y");


Take a look at Sending Keystrokes to another Application in C#.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号