November 29th, 2012, 12:17 PM
launching current version of IE to view an HTML file, from a VCC program
I tried to do this with _spawnl(), but first of all I'm not sure how to properly ask for the path to iexplore.exe, as I'm sure it will change every time MS gets a whim to move it. I know there's a GetWindowsDirectory() call, but that's not where IE resides (its in "C:\Program Files\Internet Explorer\iexplore.exe" in XP, Lord know where on win 7 or 8).
Also, even temporarily hard coding the path to make it launch with spawnl(), I can't seem to get my html document to display. I know the path to that is right (since I put it there ).
char * pFile = "someFile.htm";
char * pCmd = "C:\\Program Files\\Internet Explorer\\iexplore.exe";
int res = _spawnl(_P_NOWAIT, pCmd,pCmd, pFile, NULL); // also tried without specifying pCmd 2x
if (res == -1) MessageBox("Sorry... can\'t Open File.");
So my second question would be, how to you PROPERLY pass the file to view as an argument.
thanks for any help!
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.