Q: 如何打开一个应用程序?

ShellExecute(this->m_hWnd,"open","calc.exe","","", SW_SHOW );

ShellExecute(this->m_hWnd,"open","notepad.exe",      "c:\\MyLog.log","",SW_SHOW );

正如您所看到的,我并没有传递程序的完整路径。

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); 

最新文章

  1. ng-selected ng-change
  2. IntelliJ IDEA13.1.3+Scala2.11.1环境搭建
  3. java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntim [问题点数:40分,结帖人wangxiaohua_001]
  4. sed命令查找<media/msm_cam_sensor.h>替换为"len_msm_cam_sensor.h"
  5. 微软CEO史蒂夫·鲍尔默(Steve Ballmer)在12个月内退休
  6. 【转】C#自定义控件:WinForm将其它应用程序窗体嵌入自己内部
  7. OpenCV原则解读HAAR+Adaboost
  8. 团队作业4——第一次项目冲刺(Alpha版本) 日志集合处
  9. linux系统下安装tomcat服务器
  10. Echart横坐标时间轴滑动
  11. Windows上的程序员神器Cmder
  12. vue项目启动时将localhost替换成指定ip地址
  13. JMeter_方案上架,遇到的问题及解决
  14. C#语句从MySQL中简单的读取数据库信息
  15. LeetCode--No.013 Roman to Integer
  16. 项目Alpha冲刺--1/10
  17. AngularJS 模块及provide
  18. Golang之字符串格式化
  19. servlet-servletContext网站计数器
  20. js多条件if语句简写发生Uncaught SyntaxError: Unexpected token }

热门文章

  1. IIS日志
  2. oracle 所有下级
  3. 自定义DZLMoneyLabel
  4. 在windows7中使用计划任务命令SCHTASKS查询计划任务失败的解决方案
  5. 第一章 搭建Qt开发环境
  6. TweenMax动画库学习(一)
  7. DTCMS自定义标签:面包屑导航,栏目中通过栏目调用名称获得栏目名称
  8. 【转】分享10VPN
  9. Android桌面悬浮清内存app概述
  10. WAMP环境的安装与测试