资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

vb.net的shell的简单介绍

vb.net shell

Shell恐怕不行·

创新互联长期为上千多家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为独山子企业提供专业的网站建设、成都网站制作,独山子网站改版等技术服务。拥有10多年丰富建站经验和众多成功案例,为您定制开发。

给你个现成的:

Sub _CMD(ByVal Data As String)

Try

Dim p As New Process()‘用Process就可以

p.StartInfo.FileName = "cmd.exe"

p.StartInfo.UseShellExecute = False

p.StartInfo.RedirectStandardInput = True

p.StartInfo.RedirectStandardOutput = True

p.StartInfo.RedirectStandardError = True

p.StartInfo.CreateNoWindow = True

p.Start()

Application.DoEvents()

p.StandardInput.WriteLine(Data)’这个Data就是cmd命令

p.StandardInput.WriteLine("Exit")‘这个是退出语句

Dim strRst As String = p.StandardOutput.ReadToEnd()’执行完语句后取得显示内容.

p.Close()

Catch ex As Exception

End Try

‘之后就是你自己的代码了...

End Sub

VB.net中的shell在C#中怎么写

下面是例子,或许对你有用:

using   System;   

using   System.Diagnostics;   

using   System.ComponentModel;   

namespace   MyProcessSample   

{   

///   summary   

///   Shell   for   the   sample.   

///   /summary   

public   class   MyProcess   

{   

//   These   are   the   Win32   error   code   for   file   not   found   or   access   denied.   

const   int   ERROR_FILE_NOT_FOUND   =2;   

const   int   ERROR_ACCESS_DENIED   =   5;   

///   summary   

///   Prints   a   file   with   a   .doc   extension.   

///   /summary   

public   void   PrintDoc()   

{   

Process   myProcess   =   new   Process();   

try   

{   

//   Get   the   path   that   stores   user   documents.   

string   myDocumentsPath   =     

Environment.GetFolderPath(Environment.SpecialFolder.Personal);   

myProcess.StartInfo.FileName   =   myDocumentsPath   +   "\\MyFile.doc";     

myProcess.StartInfo.Verb   =   "Print";   

myProcess.StartInfo.CreateNoWindow   =   true;   

myProcess.Start();   

}   

catch   (Win32Exception   e)   

{   

if(e.NativeErrorCode   ==   ERROR_FILE_NOT_FOUND)   

{   

Console.WriteLine(e.Message   +   ".   Check   the   path.");   

}     

else   if   (e.NativeErrorCode   ==   ERROR_ACCESS_DENIED)   

{   

//   Note   that   if   your   word   processor   might   generate   exceptions   

//   such   as   this,   which   are   handled   first.   

Console.WriteLine(e.Message   +     

".   You   do   not   have   permission   to   print   this   file.");   

}   

}   

}   

public   static   void   Main()   

{   

MyProcess   myProcess   =   new   MyProcess();   

myProcess.PrintDoc();   

}   

}   

}

VB.net 显示 Shell 时 隐藏的程序

AppWinStyle.Hide 隐藏窗口并为隐藏的窗口提供焦点。

AppWinStyle.NormalFocus 为窗口提供焦点,并以最近的大小和位置显示窗口。

AppWinStyle.MinimizedFocus 为窗口提供焦点,并以图标的形式显示窗口。

AppWinStyle.MaximizedFocus 为窗口提供焦点,并以全屏方式显示窗口。

AppWinStyle.NormalNoFocus 将窗口设置为最近的大小和位置。当前活动窗口保持焦点。

AppWinStyle.MinimizedNoFocus 以图标的形式显示窗口。当前活动窗口保持焦点。 ***********************你上面用的是AppWinStyle.Hide ,当然看不见窗口,应该使用AppWinStyle.NormalFocus就可以切换到新打开的程序了


本文标题:vb.net的shell的简单介绍
分享URL:http://cdkjz.cn/article/dddoiji.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220