本站首页    管理页面    写新日志    退出


[C/C++技术]如何在程序中打开另一个应用程序
鸿 发表于 2006/2/8 13:00:27

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

阅读全文(6498) | 回复(1) | 编辑 | 精华

回复:如何在程序中打开另一个应用程序
SDG '(游客)发表评论于2006/9/26 15:22:17

回复:如何在程序中打开另一个应用程序

个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除
» 1 »

发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)

 
«November 2025»
1
2345678
9101112131415
16171819202122
23242526272829
30

  公告

鸿之忆blog于2006年2月6日开张,欢迎光顾!


  我的分类(专题)
  最近日志

  最新评论

  留言板

  链接


  Blog信息
blog名称:鸿之忆
日志总数:9
评论数量:9
留言数量:-1
访问次数:80460
建立时间:2006年2月6日



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.438 second(s), page refreshed 144796612 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号