您的位置:程序门 -> vc/mfc -> 进程/线程/dll



关于createjobobject()


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


关于createjobobject()
发表于: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没有定义
发表于:2007-01-19 16:08:251楼 得分:0
>   #include   <winbase.h>
--------------------------
改为   #include   <windows.h>
发表于:2007-01-19 16:12:022楼 得分:0
楼上的,不行~~
发表于:2007-01-20 20:37:413楼 得分:0
加上下面这堆东西看看
#ifndef   winver
#define   winver   0x0500
#endif

#ifndef   _win32_winnt
#define   _win32_winnt   0x0500
#endif

#ifndef   _win32_windows
#define   _win32_windows   0x0410  
#endif

发表于:2007-01-20 22:38:504楼 得分:0
同意楼上的

jobobject只支持2000以上系统
发表于:2007-01-22 09:09:355楼 得分:0
我是2000的,而且试了上述说法,不行~~~
发表于:2007-01-26 13:04:046楼 得分:0
#define   winver   0x0500
#define   _win32_winnt   0x0500
这样没用么……


快速检索

最新资讯
热门点击