简体   繁体   English

如何用C#表示VB代码?

[英]How can I express this VB code in C#?

How can I convert this from vb to c#? 如何将其从vb转换为c#?

 Call 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")  

Thx 谢谢
It is process.start("API_CALLBACK");? 是process.start(“ API_CALLBACK”);? how to do with .sendkey? .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. 在.NET中启动进程的一种方法是Process.Start方法。 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. .NET框架中还有一个方便的SendKeys类。

SendKeys.Send("{ENTER}");

And further, you can put the current thread to sleep with the Thread.Sleep method. 此外,您可以使用Thread.Sleep方法使当前线程进入睡眠状态。

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");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM