CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
花落谁家,你作主! 盛大widget设计大赛英雄榜
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  进程/线程/DLL

关于winexect 和 ShellExecute 的问题

楼主yube1982(招狼)2004-12-01 16:56:34 在 VC/MFC / 进程/线程/DLL 提问

1。winexect是干什么用的  
  2。winexect和ShellExecute   有什么区别 问题点数:50、回复次数:6Top

1 楼DentistryDoctor(不在无聊中无奈,就在沉默中变态)回复于 2004-12-01 17:11:25 得分 0

WinExec  
   
  The   WinExec   function   runs   the   specified   application.  
   
  Note     This   function   is   provided   only   for   compatibility   with   16-bit   Windows.   Applications   should   use   the   CreateProcess   function.  
   
   
  UINT   WinExec(  
      LPCSTR   lpCmdLine,  
      UINT   uCmdShow  
  );  
   
  Top

2 楼DentistryDoctor(不在无聊中无奈,就在沉默中变态)回复于 2004-12-01 17:11:47 得分 0

ShellExecute   Function  
   
  --------------------------------------------------------------------------------  
   
  Performs   an   operation   on   a   specified   file.  
   
  Syntax  
   
  HINSTANCE   ShellExecute(                     HWND   hwnd,  
          LPCTSTR   lpOperation,  
          LPCTSTR   lpFile,  
          LPCTSTR   lpParameters,  
          LPCTSTR   lpDirectory,  
          INT   nShowCmd  
  );  
  Top

3 楼ncucf(ncu晨风)回复于 2004-12-01 17:29:42 得分 10

通常用winexec就可以完成外部程序调用,如果你要复杂一点的参数和当前目录设置,就可以用shellexecute,如果更复杂的,可以用createprocessTop

4 楼Rogeremail(绿色环保-菜青虫)回复于 2004-12-01 17:45:24 得分 10

winexec属于将要淘汰的函数。Top

5 楼flinming(flinming)回复于 2004-12-01 18:18:37 得分 0

Q:   如何打开一个应用程序?  
  ShellExecute(this->m_hWnd,"open","calc.exe","","",   SW_SHOW   );  
  或  
  ShellExecute(this->m_hWnd,"open","notepad.exe",  
          "c:\\MyLog.log","",SW_SHOW   );  
  As   you   can   see,   I   haven't   passed   the   full   path   of   the   programs.    
     
  Q:   如何打开一个同系统程序相关连的文档?  
  ShellExecute(this->m_hWnd,"open",  
          "c:\\abc.txt","","",SW_SHOW   );  
     
  Q:   如何打开一个网页?  
  ShellExecute(this->m_hWnd,"open",  
          "http://www.google.com","","",   SW_SHOW   );  
     
  Q:   如何激活相关程序,发送EMAIL?  
  ShellExecute(this->m_hWnd,"open",  
          "mailto:nishinapp@yahoo.com","","",   SW_SHOW   );  
     
  Q:   如何用系统打印机打印文档?  
  ShellExecute(this->m_hWnd,"print",  
          "c:\\abc.txt","","",   SW_HIDE);  
     
  Q:   如何用系统查找功能来查找指定文件?  
  ShellExecute(m_hWnd,"find","d:\\nish",  
          NULL,NULL,SW_SHOW);  
     
  Q:   如何启动一个程序,直到它运行结束?  
  SHELLEXECUTEINFO   ShExecInfo   =   {0};  
  ShExecInfo.cbSize   =   sizeof(SHELLEXECUTEINFO);  
  ShExecInfo.fMask   =   SEE_MASK_NOCLOSEPROCESS;  
  ShExecInfo.hwnd   =   NULL;  
  ShExecInfo.lpVerb   =   NULL;  
  ShExecInfo.lpFile   =   "c:\\MyProgram.exe";                            
  ShExecInfo.lpParameters   =   "";            
  ShExecInfo.lpDirectory   =   NULL;  
  ShExecInfo.nShow   =   SW_SHOW;  
  ShExecInfo.hInstApp   =   NULL;                
  ShellExecuteEx(&ShExecInfo);  
  WaitForSingleObject(ShExecInfo.hProcess,INFINITE);  
  或:  
  PROCESS_INFORMATION   ProcessInfo;    
  STARTUPINFO   StartupInfo;   //This   is   an   [in]   parameter  
  ZeroMemory(&StartupInfo,   sizeof(StartupInfo));  
  StartupInfo.cb   =   sizeof   StartupInfo   ;   //Only   compulsory   field  
  if(CreateProcess("c:\\winnt\\notepad.exe",   NULL,    
          NULL,NULL,FALSE,0,NULL,  
          NULL,&StartupInfo,&ProcessInfo))  
  {    
          WaitForSingleObject(ProcessInfo.hProcess,INFINITE);  
          CloseHandle(ProcessInfo.hThread);  
          CloseHandle(ProcessInfo.hProcess);  
  }      
  else  
  {  
          MessageBox("The   process   could   not   be   started...");  
  }  
     
     
  Q:   如何显示文件或文件夹的属性?  
  SHELLEXECUTEINFO   ShExecInfo   ={0};  
  ShExecInfo.cbSize   =   sizeof(SHELLEXECUTEINFO);  
  ShExecInfo.fMask   =   SEE_MASK_INVOKEIDLIST   ;  
  ShExecInfo.hwnd   =   NULL;  
  ShExecInfo.lpVerb   =   "properties";  
  ShExecInfo.lpFile   =   "c:\\";   //can   be   a   file   as   well  
  ShExecInfo.lpParameters   =   "";    
  ShExecInfo.lpDirectory   =   NULL;  
  ShExecInfo.nShow   =   SW_SHOW;  
  ShExecInfo.hInstApp   =   NULL;    
  ShellExecuteEx(&ShExecInfo);  
  Top

6 楼oyljerry(【勇敢的心】→ ㊣提拉米苏√㊣)回复于 2004-12-01 20:57:57 得分 30

都可以打开进程,只不过一个参数少,功能简单,一个参数多,功能多些Top

相关问题

  • ShellExecute()
  • shellexecute和winexec有什么区别?
  • 请教ShellExecute 和 GetWindowsDirectory 的用法
  • shellexecute 和winexec 有什么区别?
  • 有关ShellExecute和CreateProcess的问题
  • ShellExecute问
  • ShellExecute和WinExec和LoadLibrary 分别是哪几个DLL里的函数???????
  • ShellExecute要Uses哪个.pas单元中?for D5 和 for D6.
  • Delphi中怎样声明和使用ShellExecute函数?
  • 为什么Del命令WINEXEC 和SHELLEXECUTE执行不了?

关键词

  • 系统
  • null
  • shexecinfo
  • shellexecute
  • winexect
  • startupinfo
  • sw
  • processinfo
  • shellexecuteinfo
  • hwnd

得分解答快速导航

  • 帖主:yube1982
  • ncucf
  • Rogeremail
  • oyljerry

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

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