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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

danelroismanCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.