By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,996 Members | 884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,996 IT Pros & Developers. It's quick & easy.

how to use ShellExecute in MFC

P: 1
how to use the ShellExecute() function to call exe files into my MFC application.
Aug 28 '10 #1
Share this Question
Share on Google+
3 Replies


weaknessforcats
Expert Mod 5K+
P: 9,197
I am not sure what you are asking. It seems you would just call the function.
Aug 28 '10 #2

P: 4
This is a small code snippet to open a pdf file in Acrobat Reader using ShellExecute() function.....

if(!strFilePath.IsEmpty())
{
strFilePath.TrimLeft();
strFilePath.TrimRight(); // To remove empty spaces

CString strAppPath("C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe");
// Application File Path ( Acrobat Reader )

if(!strAppPath.IsEmpty())
{
ShellExecute(0, "open",strAppPath, strFilePath, NULL, SW_MAXIMIZE);
}
else
{
TRACE("Invalid Application Path \n");
}
}
else
{
TRACE("Invalid pdf File Path\n");
}
Sep 3 '10 #3

weaknessforcats
Expert Mod 5K+
P: 9,197
Your path looks incorrect. It should be:

Expand|Select|Wrap|Line Numbers
  1. CString strAppPath("C:\\Program Files\\Adobe\\Acrobat 5.0\\Acrobat\\Acrobat.exe");
Sep 4 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.