CreateProcess function in ActiveX

Is it possible that the CreateProcess function returns false (0)if activated from an ActiveX, just because it is activated from ActiveX ?
HindyIlanAsked:
Who is Participating?
 
danelroismanConnect With a Mentor Commented:
No!

You can create procces from ActiveX!
(Why not?)

There is an axample from MSDN:

void CAniProgress::LaunchArchive()
{

   char szCmdLine[260];
   memset(szCmdLine,0,sizeof(szCmdLine));
   if(strlen(m_szSrc)+strlen(m_szDest)>sizeof(szCmdLine))
   {
      MessageBox("Paths are too long",
         "Error running archive",MB_OK); return;
   }

   strcpy(szCmdLine,ARCHIVE_UTIL);
   strcat(szCmdLine,(LPCSTR)m_szDest);
   strcat(szCmdLine," ");
   strcat(szCmdLine,(LPCSTR)m_szSrc);

   STARTUPINFO si;
   PROCESS_INFORMATION pi;  
   ZeroMemory( &si, sizeof(si) );
   si.cb = sizeof(si);  
   if( !CreateProcess( NULL,(LPSTR)    szCmdLine,NULL,NULL,
      FALSE, 0,NULL, NULL, &si,&pi ) )  
   {
      MessageBox("Could not run archive utility",
         "Error running archive",MB_OK); return;
   }
   
   m_Animate.Play();
   
   DWORD ExitCode=0;
   GetExitCodeProcess(pi.hProcess,&ExitCode);
   float fProgress=10.0f;
   while(STILL_ACTIVE == ExitCode)
   {
      if(fProgress > 100)
         fProgress=0;
      m_Progress.SetValue(fProgress);
      fProgress+=10.0f;
      Sleep(1000); //wait 1 second
      GetExitCodeProcess(pi.hProcess,&ExitCode);
   }

   CloseHandle( pi.hProcess );

   m_Animate.Stop();
}

Daniel
0
All Courses

From novice to tech pro — start learning today.