Internet Explorer displays a blank page when opening a local file while screen is off

Hi everyone:

I'm making a small MFC module that should generate a report (formatted using HTML) and then display it for a user on schedule at 8:30 AM every day. Pretty straightforward stuff.

I compose my report and then save it as a local HTML file in the CSIDL_APPDATA folder. I then use the following calls to display it using the default web browser (Internet Explorer in this case):


//Error checks are omitted for brevity
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
ShellExecute(NULL, NULL, strSaveFileTo, NULL, NULL, SW_SHOWNORMAL);


This module is run on schedule from the Task Scheduler. (The task is set up to run when a user is logged on, which is all the time for that PC. It is never turned off, put to sleep, etc. That computer has only one user that is never logged off either.)

This works perfectly fine when I test it by setting the task a minute or so in the future. But when the actual task is supposed to run at 8:30 AM, when the user wakes the screen all they see is a blank Internet Explorer page. (Note that if someone refreshes that page by hitting F5, only then my report is shown on the screen.)

So I started looking into it:

1) I checked that the file is properly saved (before calling ShellExecute) by reading it back and by comparing it with the original HTML markup that I saved earlier. It's all correct there.

2) I then checked the power saving options. That computer is set up to show screensaver after 5 minutes and to turn off screen after 25 minutes.

3) The web browser that causes this issue is IE version 11, with the latest updates installed. The operating system is Windows 7 Professional.

So I'm curious, what am I missing here? And why is IE showing a blank page only when computer is running unattended?
I only ask because you didn't specifically mention them:

1.) Is the HDD set to turn off ever? If so, is it coming back online when your task executes?

2.) Under the scheduled task in the 'Conditions' tab, there is a check box that says "Wake the computer to run this task". Is that check box ticked for this task?

3.) Without hitting F5, when the IE window is blank, what do you see when you right-click and select "View Source" from the drop down menu? I know you said that you checked the source HTML file before, but I'm more interested in what IE is pulling down.

4.) Is it possible that what ever process populates the report is doing so at the same time the scheduled task is running? Does the process that populates the report create the document with exclusive access?

5.) Just for posterity have you tried setting a different default browser such as Firefox or Chrome? Even if adding another browser to the users machines isn't an option, knowing whether or not they work will help us narrow down the scope of this issue.

6.) Under Control Panel\Network and Internet\Network Connections right click on the adapter that is being used and select 'Properties'. Then under the 'Power Management' tab check to see if the system is being allowed to turn off this device to conserve power. You may want to take this a step further and check for a similar setting in the Mainboard BIOS.

You mentioned that you had error checks, do you save the return value from "ShellExecute()" anywhere? If not you should fix that.
Last edited on
Thanks for the reply. I think I got to the bottom of it (sort of.) It appears to have been a bug in the IE rendering engine. It's not that doing F5 or refreshing brings my page back up, even resizing the IE window does the same. Thus I concluded that it's a bug.

As a "hacky" workaround one can wake screen by doing this that will make IE render everything correctly:

::SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM)-1);
::Sleep(500);

Or as a better solution -- install and use Chrome instead :)
Topic archived. No new replies allowed.