QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3961|回复: 0
打印 上一主题 下一主题

使用CreateProcess()函数

[复制链接]
字体大小: 正常 放大
韩冰        

823

主题

3

听众

4048

积分

我的地盘我做主

该用户从未签到

发帖功臣 元老勋章

跳转到指定楼层
1#
发表于 2005-1-26 01:30 |只看该作者 |倒序浏览
|招呼Ta 关注Ta

使用CreateProcess()函数' G5 f; L0 z, ^# x

0 z; Y4 t/ y! i Y$ W; Y: T r8 N% |

以下是一个使用CreateProcess()函数的例子: - C% P8 [7 H+ P2 _0 A% \+ M( Bvoid CreateChildProcessAndWaitUntilDone(const AnsiString& strCmdLine) % D% ~4 j1 V: m% L1 U j% g {

0 g1 r5 a5 i8 m! `4 L3 F# `

PROCESS_INFORMATION piProcInfo; $ N$ b4 Z6 I( W9 K) i- h5 VSTARTUPINFO siStartInfo;

O% V& v6 `! E8 ^

// Set up members of STARTUPINFO structure.) J# h4 J6 D+ Q& s8 s- Y siStartInfo.cb = sizeof(STARTUPINFO); 0 B& k1 }. B* t3 I$ c) J/ asiStartInfo.lpReserved = NULL;! w! Q6 K7 U- {5 ~ siStartInfo.lpReserved2 = NULL; + r$ b1 f' K$ t O* X siStartInfo.cbReserved2 = 0; 7 D8 y' Z0 v1 D$ {+ ?siStartInfo.lpDesktop = NULL; & s* q5 u' }. B) x$ g siStartInfo.dwFlags = 0;

7 ?+ t: E6 t: _" [0 t

% X. Z& n$ P8 f V' w4 I, ]// Create the child process. ! m; o: T- p. B/ ], SCreateProcess(

$ `" [- a$ P' I0 G6 w4 t# t

NULL, ?7 m% X! @% W# k" X& |strCmdLine.c_str(), # [" U1 A1 l9 U8 s4 X) Q; K! W& @NULL, // process security attributes $ I3 K4 q2 w/ T! w6 ?2 d9 pNULL, // primary thread security attributes + a }7 L% ` w1 [: Y7 Z3 y0, // handles are inherited 7 T4 _" f8 e+ z0, // creation flags * C( T6 p+ u7 z) y3 i' E. kNULL, // use parent's environment$ y1 _ D) o) J3 ?( Q* v NULL, // use parent's current directory$ [6 @5 U1 R! Z; P* w3 v &siStartInfo, // STARTUPINFO pointer 3 |; w( N/ q( h4 j% x4 B&piProcInfo); // receives PROCESS_INFORMATION

9 T2 u4 j, ^5 d% ~

// Wait for the processs to finish 9 y. h' o9 {/ D ~- d pDWORD rc = WaitForSingleObject(1 c7 u) M; a v( d piProcInfo.hProcess, // process handle: b0 ~# n" L/ X: B INFINITE); " E1 E% \$ a1 \/ e4 G* |8 U1 U! C* Q0 j }: d# i% n ]+ c* O# J% v # y1 C0 v. ?* m, M r! d3 E6 _3 b* f

zan
转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
您需要登录后才可以回帖 登录 | 注册地址

qq
收缩
  • 电话咨询

  • 04714969085
fastpost

关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

手机版|Archiver| |繁體中文 手机客户端  

蒙公网安备 15010502000194号

Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

GMT+8, 2026-4-20 17:40 , Processed in 0.425186 second(s), 51 queries .

回顶部