how to invoke program without system()

how to invoke program without system()

Post by Varf » Wed, 07 Jan 2004 04:31:54


Hi,
I'm trying to start a web browser from within my program,
which will become a separate running process from my program,
and I am finding it difficult to locate info in MSDN about
how to do this. All I know now is exec, spawn and system.
Can anyone tell me how to do this with a native Windows
call?
Thanks in advance.
 
 
 

how to invoke program without system()

Post by CheckAbdou » Wed, 07 Jan 2004 04:35:35

Take a look at the following API's

ShellExecute[Ex]()
CreateProcess()

--
Cheers
Check Abdoul [VC++ MVP]
-----------------------------------

 
 
 

how to invoke program without system()

Post by Joseph M. » Thu, 08 Jan 2004 13:52:44

These are all quaint hangovers from Unix, and are pretty useless in practice. If you have
a URL, ShellExecute of the URL will launch the user-selected default browser. You could
use CreateProcess, but then you have to figure out what browser the user has configured.
This is stored somewhere in the Registry, but I don't know where.
joe




Joseph M. Newcomer [MVP]
email: XXXX@XXXXX.COM
Web: http://www.yqcomputer.com/
MVP Tips: http://www.yqcomputer.com/
 
 
 

how to invoke program without system()

Post by David Crow » Thu, 08 Jan 2004 23:44:45

It depends on the file's extension. Take .htm files for example. You'd
first have to look in HKEY_CLASSES_ROOT\.htm to get the Default value. In
this case, it's htmlfile. Then you'd have to use that to get the actual
application associated with it. That's found at
HKEY_CLASSES_ROOT\htmlfile\shell\open\command.

Another way is to use the protocol, http for example. For this, you'd
simple look at HKEY_CLASSES_ROOT\http\shell\open\command.
 
 
 

how to invoke program without system()

Post by CheckAbdou » Fri, 09 Jan 2004 00:16:27


& this process of retrieving the associated application's full name can
be done by calling the AssocQueryString() API.

--
Cheers
Check Abdoul [VC++ MVP]
-----------------------------------
 
 
 

how to invoke program without system()

Post by Joseph M. » Fri, 09 Jan 2004 02:37:57

Cool!
joe




Joseph M. Newcomer [MVP]
email: XXXX@XXXXX.COM
Web: http://www.yqcomputer.com/
MVP Tips: http://www.yqcomputer.com/