Thread/CreateProcess Help Please ! 
Author Message
 Thread/CreateProcess Help Please !

I am trying to create a thread and then have that thread create a process
(e.g. execute an external program like command.com or wordpad.exe. It
doesn't work why?

When I call the CreateProcess function from within the main program it
works, but when I move it to the function called my AfxBeginThread it fails.
Why?

Thanks for the help.
J.K.



Thu, 09 Jan 2003 03:00:00 GMT  
 Thread/CreateProcess Help Please !
Hi,
what did GetLastError() told you?

"J.K." schrieb:

Quote:
> I am trying to create a thread and then have that thread create a process
> (e.g. execute an external program like command.com or wordpad.exe. It
> doesn't work why?

> When I call the CreateProcess function from within the main program it
> works, but when I move it to the function called my AfxBeginThread it fails.
> Why?

> Thanks for the help.
> J.K.



Thu, 09 Jan 2003 03:00:00 GMT  
 Thread/CreateProcess Help Please !

Quote:

>I am trying to create a thread and then have that thread create a process
>(e.g. execute an external program like command.com or wordpad.exe. It
>doesn't work why?

>When I call the CreateProcess function from within the main program it
>works, but when I move it to the function called my AfxBeginThread it fails.
>Why?

It's impossible to say without seeing some code. If I were to guess,
it's working in your main thread by luck. Perhaps you're not properly
initializing the STARTUPINFO struct?

--
Doug Harrison [VC++ MVP]
Eluent Software, LLC
http://www.eluent.com
Useful tools for Visual C++ and Windows



Thu, 09 Jan 2003 03:00:00 GMT  
 Thread/CreateProcess Help Please !
If you need to pause the scheduling app until the scheduled app is complete
either use CreateProcess or ShellExecuteEx. You will then have a process
handle on which you can WaitForSingleObject. This will pause the scheduling
app until the scheduled app is complete.

Chris Rolon


Quote:
> Also, if all you want to do is to execute another program, then you can
use
> ShellExecute(Ex). ShellExecute(Ex) has some nice features that are very
easy
> to use, but I don't know if it allows you to do things like: "Execute
> another program (process 2), and pause the current process 1, until
process
> 2 terminates."

> Niki




> > >I am trying to create a thread and then have that thread create a
process
> > >(e.g. execute an external program like command.com or wordpad.exe. It
> > >doesn't work why?

> > >When I call the CreateProcess function from within the main program it
> > >works, but when I move it to the function called my AfxBeginThread it
> fails.
> > >Why?

> > It's impossible to say without seeing some code. If I were to guess,
> > it's working in your main thread by luck. Perhaps you're not properly
> > initializing the STARTUPINFO struct?

> > --
> > Doug Harrison [VC++ MVP]
> > Eluent Software, LLC
> > http://www.eluent.com
> > Useful tools for Visual C++ and Windows



Thu, 09 Jan 2003 03:00:00 GMT  
 Thread/CreateProcess Help Please !
Also, if all you want to do is to execute another program, then you can use
ShellExecute(Ex). ShellExecute(Ex) has some nice features that are very easy
to use, but I don't know if it allows you to do things like: "Execute
another program (process 2), and pause the current process 1, until process
2 terminates."

Niki



Quote:

> >I am trying to create a thread and then have that thread create a process
> >(e.g. execute an external program like command.com or wordpad.exe. It
> >doesn't work why?

> >When I call the CreateProcess function from within the main program it
> >works, but when I move it to the function called my AfxBeginThread it
fails.
> >Why?

> It's impossible to say without seeing some code. If I were to guess,
> it's working in your main thread by luck. Perhaps you're not properly
> initializing the STARTUPINFO struct?

> --
> Doug Harrison [VC++ MVP]
> Eluent Software, LLC
> http://www.eluent.com
> Useful tools for Visual C++ and Windows



Fri, 10 Jan 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Thread\CreateProcess Help please.

2. Please help!!!!Please help!!!!Please help!!!!Please help!!!!Please help!!!!Please help!!!!Please help!!!!

3. Please help!!!!Please help!!!!Please help!!!!

4. Bad Thread ID from CreateProcess()

5. CreateProcess in dll thread

6. The Thread that wont die. - Please Help

7. freeing handles, GC, and threading .... please help

8. Please help me implement threading

9. SunOS threads - PLEASE HELP

10. Please Help - Adding Controls to a form from a child thread

11. Please help me to choose a threading model

12. Help Please - Identifying Process Threads

 

 
Powered by phpBB® Forum Software