eqvivalent for VB "Shell Function"

i'm VB.
i'm looking for MFC\VC++ eqvivalent for VB Shell Function.
this function activates any application from the current code.
examples :
Shell "path To App EXE",windowMode(Constants available)

or :

Shell "pathToDocFile_pathToWinword",WindowMode

etc...

knowing no eqvivalent in MFC\VC++, i've tried to include the
Proccess.H lib, and used :
system("ApplicationPath");

that's works fine only when the path is in the same dir :

system("abc.exe");
system("abc.msi");

this one is not executing (the path is correct) :

system("I:\Program Files\Project1\Project1.exe");

this line raise 3 warnings :
warning C4129: 'P' : unrecognized character escape sequence

i suspect it's the Slash or space in folder name or long folder name.

another thing i've tried is a batch file. that's fine exept that it don't get a folder name like "Program Files"

anyway, i need an MFC\VC++ solution as simple as VB....

thank you.
Sub_MainAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
chensuConnect With a Mentor Commented:
Use the Win32 functions - ShellExecute or ShellExecuteEx.
0
 
chensuCommented:
By the way, the warning error is due to the escape character '\'. It should read

system("I:\\Program Files\\Project1\\Project1.exe");

0
 
chensuCommented:
::ShellExecute(hWnd, NULL, _T("c:\\dirname\\abc.exe"), NULL, NULL, SW_SHOWNORMAL);
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Sub_MainAuthor Commented:
does compiling it with MFC lib linked  - will make the EXE run on any machine without instllation ?

i mean, in VB - if you just create an empty project - you have to install all VB runtime DLLs on the target machine.
i want to use MFC in order to distribute only the EXE by copying it.
will it work under any 95\98\NT clean fresh machine ?
0
 
chensuCommented:
ShellExecute is a Win32 API function, meaning that it is available on any Windows 95, 98 and NT. Actually, even Windows 3.1 supports it.
0
 
Sub_MainAuthor Commented:
tnx
0
All Courses

From novice to tech pro — start learning today.