KeyCode:
Void credirectpipedlg: onbnclickedruncmd () <br/> {<br/> // todo: add your control notification handler Code <br/> updatedata (); <br/> m_stroutput = ""; <br/> security_attributes SA; <br/> handle hread, hwrite; <br/> SA. nlength = sizeof (security_attributes); <br/> SA. lpsecuritydescriptor = NULL; <br/> SA. binherithandle = true; <br/> If (! Createpipe (& hread, & hwrite, & SA, 0) <br/>{< br/> MessageBox (_ T ("error on createpipe ()")); <br/> return; <br/>}< br/> startupinfo Si; <br/> process_information PI; <br/> Si. CB = sizeof (startupinfo); <br/> getstartupinfo (& Si); <br/> Si. hstderror = hwrite; <br/> Si. hstdoutput = hwrite; <br/> Si. wshowwindow = sw_hide; <br/> Si. dwflags = startf_useshowwindow | startf_usestdhandles; <br/> cstring strcmd (_ T ("CMD/C/" ") + m_strcmd + _ T ("/""); <br/> If (! CreateProcess (null, (lpstr) strcmd. getstring (), null, null, true, null, & Si, & PI )) <br/>{< br/> MessageBox (_ T ("error on CreateProcess ()"); <br/> return; <br/>}< br/> closehandle (hwrite); <br/> char buffer [1, 4096] = {0}; <br/> DWORD bytesread; <br/> while (true) <br/> {<br/> If (readfile (hread, buffer, 4095, & bytesread, null) = NULL) <br/> break; <br/> m_stroutput + = buffer; <br/> memset (buffer, 0, 4096); <br/> updatedata (false ); <br/> sleep (200); <br/>}< br/>}
: