您的位置:程序门 -> vc/mfc -> 基础类



lpstartupinfoa si如何初始化呢?我想应用在createprocessa中.


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


lpstartupinfoa si如何初始化呢?我想应用在createprocessa中.[已结贴,结贴人:xhwu3721]
发表于:2007-06-21 19:32:07 楼主
这样定义为什么不对呢?执行时总是出错,提示说: "run-time   check   failure   #3   -   the   variable   'si '   is   being   used   without   being   defined. "
lpstartupinfoa   si;
lpprocess_information   pi;
memset(si,0,sizeof(si));
memset(pi,0,sizeof(pi));

si-> cb   =   sizeof(lpstartupinfoa);
getstartupinfoa(si);
si-> hstderror   =   hwrite;
si-> hstdoutput   =   hwrite;
// si.wshowwindow   =   sw_show;
// si.wshowwindow   =   sw_hide;
si-> dwflags   =   startf_useshowwindow   ¦   startf_usestdhandles;
发表于:2007-06-21 19:56:321楼 得分:10
startupinfo   si;
        process_information   pi;

        zeromemory(   &si,   sizeof(si)   );
        si.cb   =   sizeof(si);
        zeromemory(   &pi,   sizeof(pi)   );

        //   start   the   child   process.  
        if(   !createprocess(   null,       //   no   module   name   (use   command   line).  
                text( "mychildprocess "),   //   command   line.  
                null,                           //   process   handle   not   inheritable.  
                null,                           //   thread   handle   not   inheritable.  
                false,                         //   set   handle   inheritance   to   false.  
                0,                                 //   no   creation   flags.  
                null,                           //   use   parent 's   environment   block.  
                null,                           //   use   parent 's   starting   directory.  
                &si,                             //   pointer   to   startupinfo   structure.
                &pi   )                           //   pointer   to   process_information   structure.
        )  
        {
                printf(   "createprocess   failed   (%d).\n ",   getlasterror()   );
                return;
        }

发表于:2007-06-21 21:27:172楼 得分:10
不要定义指针。


快速检索

最新资讯
热门点击