c++创建进程执行文件
2017-07-21 10:47
309 查看
// ConsoleApplication3.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> #include <string> #include<windows.h> #include<iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { wstring szCmdLine = L"E:\\svn\\备份\\cefclient\\Release\\安装包\\科学阅读器 Setup.exe"; //wstring szCmdLine = L"C:\\Users\\Jin\\Documents\\Visual Studio 2013\\Projects\\Win32Project2\\Debug\\Win32Project2.exe"; STARTUPINFO si = { sizeof(si) }; PROCESS_INFORMATION pi; si.wShowWindow = 1; //si.dwFlags = STARTF_USESHOWWINDOW; BOOL ret = ::CreateProcessW( NULL, &szCmdLine[0], NULL, NULL, 0, 0, NULL, NULL, &si, &pi); if(ret) { ::CloseHandle(pi.hProcess); ::CloseHandle(pi.hThread); std::cout<<"新进程的id:"<<pi.dwProcessId<<std::endl <<"Thread id:"<<pi.dwThreadId<<std::endl; } return 0; return 0; }
相关文章推荐
- WIN32API函数CreateProcess创建一个新的进程和它的主线程,新进程运行指定的可执行文件
- linux c/c++ 编程之-----创建管道文件,并实现两个进程间的信息传递。
- [C/C++]获得本进程可执行文件的全路径
- C++中调用外部可执行程序的方法--创建子进程
- Android应用程序中用Java创建本地进程来执行C/C++程序
- VC 创建新进程,结束进程 (打开exe等可执行文件)
- 进程的创建与可执行文件的加载
- 进程的创建与可执行文件的加载
- windows创建一个执行可执行文件的进程!
- Delphi CreateProcess WIN32API函数CreateProcess用来创建一个新的进程和它的主线程,这个新进程运行指定的可执行文件
- 可执行文件的装载与进程
- C++实例 单文件创建
- Linux内核设计的艺术-进程2的创建及执行
- 根据进程句柄获得可执行文件路径的几种方法
- 用NMAKE创建VS2012 C++工程三 自动编译所有的cpp文件
- 进程的创建与可执行程序的加载
- 在linux平台上创建超小的ELF可执行文件
- C++ CreateProcess API创建进程
- 获取c++执行文件的当前目录
- Yii2.0源码分析之——控制器文件分析(Controller.php)创建动作、执行动作