We help IT Professionals succeed at work.
Get Started

Peculiar error when opening html file from DVD in Internet Explorer using ShellExecuteEx

crysallus
crysallus asked
on
452 Views
Last Modified: 2013-11-27
Hi,

My first question, so apologies if I've done something wrong. Still learning the ropes around here.

Anyway, here's what I'm trying to do.

I have a DVD that contains both normal DVD content (video in VIDEO_TS folder), as well as a bunch of html pages containing extra informational resources. To make it as easy as possible for the end users, I've written a small launching program that just contains 2 buttons, one to launch a DVD player to play the DVD, the other to open the front page for the html content. This launching program is set to autorun in an autorun.inf file.

And it all works fine except for the opening of the html front page when:

- it's being run from a DVD (and not from a usb thumb drive during testing)
- Internet Explorer is the default web browser (consequently it's the browser being used to open the html file)
- and IE isn't already open when the launcher program attempts to open the html file.

In all other scenarios it works perfectly. Testing from a thumb drive, it always works. From the DVD, any other web browser (Firefox, Chrome, Opera, Safari have all been tested) works fine. If IE is open before the launching program attempts to open the html file, it works as well. Just not from the DVD, using IE, when IE isn't already open. In that case, on my vista machine, IE closes instantly, no errors, messages boxes, nothing. On another windows 7 machine, it just sits there with 'Connecting...' in the tab title, and does nothing. In both cases it's IE 8.

My launching program is a Win32 project written using Visual C++ Express 2008. To open the html file it uses ShellExecuteEx, as follows (minus some error handling unneeded for this post):

SHELLEXECUTEINFOW info;
info.cbSize = sizeof(SHELLEXECUTEINFOW);
info.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOASYNC;
info.hwnd = NULL;
info.lpVerb = L"open";
info.lpFile = filename;
info.lpParameters = NULL;
info.lpDirectory = NULL;
info.nShow = SW_SHOWNORMAL;

ShellExecuteExW(&info);

filename is a LPCWSTR being passed to the function containing the code above. It contains the full path of the html file to open, including the correct drive letter which has been determined by earlier code. I know that ShellExecuteExW is returning successfully, because if it doesn't, a message box appears indicating an error has occurred (I left that bit out above for clarity).

The launching program terminates very soon after this call, hence the SEE_MASK_NOASYNC flag, though I've done this mostly because msdn said to, not so much because I understand completely the reason for it, apart from the brief msdn explanation.

COM is also being initialised according the msdn documentation for ShellExecute.

If anyone has any clues on this, that would be most appreciated.
Comment
Watch Question
This problem has been solved!
Unlock 2 Answers and 5 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE