| 发表于:2007-01-19 15:28:08 楼主 |
#include "stdafx.h " #include <winbase.h> #include <malloc.h> int apientry winmain(hinstance hinstance, hinstance hprevinstance, lpstr lpcmdline, int ncmdshow) { // todo: place code here. dword nbufferlength; lpstr lpbuffer; lpbuffer = (lpstr)malloc(5000*sizeof(char)); dword dreturn; nbufferlength = 5000; dreturn = getcurrentdirectory(nbufferlength,lpbuffer); lpstr lpname = "\\t1.exe "; lpstr lpEXECname = strcat(lpbuffer,lpname); startupinfo si; zeromemory( &si, sizeof(si) ); _process_information lppiprocinfo; zeromemory( &lppiprocinfo, sizeof(lppiprocinfo) ); /*****************************************/ /*创建作业*/ security_attributes jobattributes; lpctstr lpjobname = "job1 "; createjobobject(null,lpjobname); /*****************************************/ bool tt = createprocess( lpbuffer, null, null, null, false, create_new_console, null, null, &si, &lppiprocinfo ); // bool tt = createprocess(lpbuffer, null, null, null, // false, create_new_console, null, null, &si, &lppiprocinfo); waitforsingleobject( lppiprocinfo.hprocess, infinite ); closehandle( lppiprocinfo.hprocess ); closehandle( lppiprocinfo.hthread ); dword it = getlasterror(); if( tt == true ) { messagebox(null, "hello ", "hello ",mb_ok); } else { messagebox(null, "no ", "hello ",mb_ok); } return 0; } 为什么总是提示我createjobobject没有定义 |
|
|
|
|