VB.NET启动外部程序

启动外部应用程序可以通过shell函数和Process类实现。

在VB中可以使用shell函数来启动外部应用程序,而VB.NET新增加了Process类启动的方法。

Shell函数

用法:Shell(pathname[,windowstyle]) pathname是路径名,windowstyle是窗口风格设置,通过常量设置。

但是shell只能异步地启动程序,只有等启动的应用程序结束后,才能返回自己的程序继续运行。

Process类

它是System.Diagnostics命名区域中的类。System.Diagnostics.Process.Start用来启动程序,System.Diagnostics.Process.StartInfo用来设置窗口的风格。

Dim mProcess as System.Diagnostics.Process

mProcess.StartInfo.Filename=""

mProcess.StratInfo.Window

mProcess.Strat()