Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I'm fairly new at this, for C++ at-least. in VB i used Shell("explorer C:\program files\") to open a file or folder. But in Visual Studio C++. It seems to be much more difficult. I tried

Shell("C:\\Program File\\Test.exe); 


But I get identifier cant be found. Iv searched around, and some people mentioned adding #include <stdio.h> ( I think thats the right one?) . But then I end up with like 200+ errors. So could somebody help me do this the correct way. Thanks in advance.
Posted

1 solution

Please see the function ShellExecute: http://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx[^].

As you can see, this function is specific to Windows. For a portable code, see the function system:
http://www.cplusplus.com/reference/clibrary/cstdlib/system/[^].

See also this discussion:
http://stackoverflow.com/questions/9303660/system-vs-shellexecute-differences[^].

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900