开发者

How can I express this VB code in C#?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜