Question

I am trying to build an install CD with a custom MFC application set to autorun when the CD is inserted.

The instructions are included as a simple html page with images and links to PDF documents, all of which are located on the CD.

In the past I'd used the following to open the html page with the default browser:

ShellExecute(NULL, "open", <full path to .htm file including CD drive letter>, NULL, NULL, SHOWNORMAL);

But when testing with IE8 under vista I've encountered the following:

  1. Explorer launches
  2. The tab says 'Connecting'
  3. Explorer dissappears

This has to do with protected mode, since if you turn off protected mode for the internet zone, the problem goes away.

The strange thing is that the problem only shows up once everthing is burned onto a CD. If I just run the autorun executable manually from my hard drive, the html page comes up just fine.

So I'm asking if there is anything specific I can do to fix this? Or if there is another mechanism for opening URLs with the user's default browser that might not have this problem?

Was it helpful?

Solution

Since you can be reasonably sure that IE is installed you might want to execute

iexplore.exe [URL] 

in your shellex call.

In case IE is not installed, check the return value to see if it isn't not found. If so do your original shellex call directly on the .htm file.

Alternatively, You can copy the .htm to a %TEMP%, and run the shellex call from there. That way it gets around the protected aceess from a "risky" location.

OTHER TIPS

Can you capture and display the return code from the ShellExecute? That might give us a clue as to what is happening.

result = ShellExecute(...

Possible return codes are listed here:

http://support.microsoft.com/kb/238245

It says in your question that you are hard-coding the CD-ROM drive letter. Does the machine you are testing on have a different drive letter than the one you created the CD on?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top