CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
【经验总结】不能实施并行处理的情况 浅谈并行编程中的任务分解模式
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  .NET技术 >  C#

怎样使WinExe程序能接受参数?

楼主arens2003(arens2003)2004-05-08 14:25:58 在 .NET技术 / C# 提问

最好给出示例代码,谢谢! 问题点数:10、回复次数:5Top

1 楼arens2003(arens2003)回复于 2004-05-08 14:38:19 得分 0

?Top

2 楼linaren(JAVA/LINUX...)回复于 2004-05-08 15:15:40 得分 0

main()函数不是可以传参数的吗  
  取就行了Top

3 楼hbxtlhx(平民百姓-自已动手,丰衣足食)回复于 2004-05-08 15:23:22 得分 10

为什么不用Process来做呢,这个可以传参的,WinEXE是个简单的东西.System.Diagnostics   命名空间Top

4 楼hbxtlhx(平民百姓-自已动手,丰衣足食)回复于 2004-05-08 15:24:24 得分 0

如下一个MSDN的例子:  
  using   System;  
  using   System.Diagnostics;  
  using   System.ComponentModel;  
   
  namespace   MyProcessSample  
  {  
          ///   <summary>  
          ///   Shell   for   the   sample.  
          ///   </summary>  
          public   class   MyProcess  
          {  
                 
                  ///   <summary>  
                  ///   Opens   the   Internet   Explorer   application.  
                  ///   </summary>  
                  public   void   OpenApplication(string   myFavoritesPath)  
                  {  
                          //   Start   Internet   Explorer.   Defaults   to   the   home   page.  
                          Process.Start("IExplore.exe");  
                                           
                          //   Display   the   contents   of   the   favorites   folder   in   the   browser.  
                          Process.Start(myFavoritesPath);  
     
                  }  
                   
                  ///   <summary>  
                  ///   Opens   urls   and   .html   documents   using   Internet   Explorer.  
                  ///   </summary>  
                  public   void   OpenWithArguments()  
                  {  
                          //   url's   are   not   considered   documents.   They   can   only   be   opened  
                          //   by   passing   them   as   arguments.  
                          Process.Start("IExplore.exe",   "www.northwindtraders.com");  
                           
                          //   Start   a   Web   page   using   a   browser   associated   with   .html   and   .asp   files.  
                          Process.Start("IExplore.exe",   "C:\\myPath\\myFile.htm");  
                          Process.Start("IExplore.exe",   "C:\\myPath\\myFile.asp");  
                  }  
                   
                  ///   <summary>  
                  ///   Uses   the   ProcessStartInfo   class   to   start   new   processes,   both   in   a   minimized    
                  ///   mode.  
                  ///   </summary>  
                  public   void   OpenWithStartInfo()  
                  {  
                           
                          ProcessStartInfo   startInfo   =   new   ProcessStartInfo("IExplore.exe");  
                          startInfo.WindowStyle   =   ProcessWindowStyle.Minimized;  
                           
                          Process.Start(startInfo);  
                           
                          startInfo.Arguments   =   "www.northwindtraders.com";  
                           
                          Process.Start(startInfo);  
                           
                  }  
   
                  public   static   void   Main()  
                  {  
                                          //   Get   the   path   that   stores   favorite   links.  
                                          string   myFavoritesPath   =    
                                          Environment.GetFolderPath(Environment.SpecialFolder.Favorites);  
                                   
                                          MyProcess   myProcess   =   new   MyProcess();  
                     
                          myProcess.OpenApplication(myFavoritesPath);  
                          myProcess.OpenWithArguments();  
                          myProcess.OpenWithStartInfo();  
   
                                }          
          }  
  }  
  Top

5 楼arens2003(arens2003)回复于 2004-05-08 15:36:41 得分 0

谢谢楼上的兄弟  
  不过我的意思是使我的程序能在被别的程序调用的时候给传入参数的  
  问题是:我不知道怎样取得别的程序传给我的参数Top

相关问题

  • 菜鸟问题:Console程序如何接受参数、取参数
  • 怎么让程序启动的时候接受参数?
  • 如何使程序接受外部参数?
  • vb 应用程序如何接受外部参数
  • VB程序能否接受命令行参数(XXX.exe 7,"Bill Gates")?怎么在程序中接收这些参数?
  • 程序Command参数?
  • 请教:用VB做的程序如何接受命令行参数?
  • 程序带参数执行?
  • 简单的问题,如何使我编的应用程序接受命令行参数,如notepad a.txt
  • MFC程序怎么和MPICH配合使用? (MFC如何接受命令行参数?)

关键词

  • start
  • internet
  • myprocess
  • myfavoritespath
  • 参数
  • iexplore
  • startinfo
  • 程序
  • processstartinfo
  • process

得分解答快速导航

  • 帖主:arens2003
  • hbxtlhx

相关链接

  • CSDN .NET频道
  • .NET类图书
  • C#类图书
  • .NET类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
惹火投票。。火热进行中...
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
CSDN网站24小时值班电话:13552009689
Copyright © 2000-2009, CSDN.NET, All Rights Reserved
GongshangLogo