簡體   English   中英

C#中的VB6等效代碼

[英]VB6's equivalent code in C#

這是示例代碼,我必須在C#中進行轉換。 由於這段代碼是很久以前編寫的,而且我對VB並不了解,因此如果提供C#版本將非常有幫助。

編碼:

ChDir ("c:\folder")
a = Shell("c:\folder\some.exe C /LINK ", 1)        
Sleep 6000   'Implements a 1 second delay
sParameters = "Something"
a = ExecCmd(sParameters)

我在MSDN上進行了搜索,看到了Shell的作用,但我仍然感到困惑。 請幫我。

搜索關於

Process.Start("c:\folder\some.ex");

如果您的應用需要參數:

ProcessStartInfo si= new processStartInfo();
si.fileName="c:\folder\some.exe";
si.CreateNoWindow = false;
si.UseShellExecute = false;

si.WindowStyle = ProcessWindowStyle.Hidden;
si.arguments="arguments here";
try
    {
        // Start the process with the info we specified.
        // Call WaitForExit and then the using statement will close.
        using (Process exeProcess = Process.Start(si))
        {
        exeProcess.WaitForExit();
        }
    }
    catch
    {
        // Log error.
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM