Creating process to run IE on new Windows desktop

I'm trying to set up an IE kiosk which runs IE on a separate desktop. While I'm testing I'm just starting IE normally (not in kiosk mode), but although IE starts up on the new desktop it doesn't load the initial page specified in the command string, it just sits there with the hourglass flickering on and off really quickly (even when I move the mouse elsewhere on the desktop, outside the IE window). There is no URL displayed in the navigation box. I can access the menus and so on inside IE, but even if I type in a URL by hand nothing happens. Closing IE takes me back to the default desktop as expected.

A couple of extra things I tried: launching a command prompt (works fine, and I can ping the site I'm trying to connect to, so Internet access from the new desktop isn't blocked); launching Notepad with a filename parameter (works fine, opens the specified file, so I'm passing the command-line parameter correctly).

This is my code; any thoughts welcomed:

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPTSTR    lpCmdLine,
                   int       nCmdShow)
  char* desktop   = "MyDesktop";

  HDESK hThreadDT = GetThreadDesktop(GetCurrentThreadId());
  HDESK hNewDT    = CreateDesktop(desktop, NULL, NULL, 0, GENERIC_ALL, NULL);


  if (SetCurrentDirectory("C:\\Program Files\\Internet Explorer")) {

    memset(&pi, 0, sizeof(pi));
    memset(&si, 0, sizeof(si));
    si.cb = sizeof(si);
    si.lpDesktop = desktop;

    if (CreateProcess(NULL, "iexplore.exe",
                      NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
    else {
      char msg[1000];
      wsprintf(msg,"CreateProcess failed (%d)",GetLastError());


  return 0;


Try passing the following command line to CreateProcess (more info):

"iexplore.exe -k -noframemerging"

You also have an option to automate Internet Explorer via OLE InternetExplorer.Application object, particularity with put_Visible, put_FullScreen and Navigate2 methods.

Need Your Help

How to access local and server database in a single project/file Randomly

php mysql

How to access local and server database in a single project/file Randomly

RavenDB ForEach ExtensionMethod abstraction

c# linq ravendb

I am doing a lot of backend data manipulation of data in RavenDb (not website crud). I have dozens of methods scattered around for doing essentially the same skip/take queries, but with different