Help on external process invokation in VC++

  • Thread starter Thread starter Chaw-Chi Yu
  • Start date Start date
C

Chaw-Chi Yu

Hi,

I have an existing VB program that invokes an external VC++ program
using Shell command. The VC++ program uses ParseCommandLine() and
ProcessShellCommand() MFC APIs to execute the request from VB. Now I
need to go the other way, i.e. have a VC++ program to invoke an external
VB program with command line arguments. Could any one please tell me
what's the API in VC++ to invoke an exernal program and what's the APIs
in VB to parse the command line arguments and execute the command?

Your help is greatly appreciated.

Thanks,
Chaw-Chi Yu
 
Chaw-Chi Yu said:
Could any one please tell me what's the API in VC++ to invoke an exernal
program and what's the APIs in VB to parse the command line arguments
and execute the command?

Sound like a good question at
 
Hi,

Incorrect group but

To launch any app :
HINSTANCE ShellExecute(
HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd
);

Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA"
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String,
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As
Long) As Long

and about parsing command line ... you can get:

Public Declare Function GetCommandLine Lib "kernel32" Alias
"GetCommandLineA" () As String

Public Declare Function CommandLineToArgv Lib "shell32" Alias
"CommandLineToArgvW" (ByVal lpCmdLine As String, pNumArgs As Integer) As
Long

and loop basis on sample:
http://msdn2.microsoft.com/en-us/library/ms647232.aspx

Marcin Domaslawski
 
Back
Top