Pablo Galiano : VS Shell application switches

Subscriptions

<September 2010>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

News

Subscribe to Pablo Galiano by Email

Post Categories

VS Shell application switches

If you want to know what happens behind the scenes when we execute a VS Shell application you can read Craig's post about the VS Shell architecture.

To summarize Craig's post when we execute a VS Shell application, it will find and load the appenvstub.dll (shipped with the VS SDK) and call one of the three exported methods of this dll (Start, Setup or Remove). Then the appenvstub.dll will act as a translator between the VS Shell Application and msenv.dll who is responsible for doing all the work.

The important thing (and purpose of this post) is that the VS Shell application calls the appenvstub.dll and passes the name of the Application (SKU), the command line switch (Start/Setup/Remove) and the rest of the command line buffer.

We can take a look at the main .cpp of the VS Shell application to see how it works:

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
    ...

    if(fDoSetup)
    {
    ...
        nRetVal = Setup(W2A(lpCmdLine), L"MyAppName_MyAppGUID", NULL);
    ...

    }
    else if(fDoRemove)
    {
    ...
        nRetVal = Remove(W2A(lpCmdLine), L"MyAppName_MyAppGUID");
    ...
    }
    else
    {
    ...
        nRetVal = Start(W2A(lpCmdLine), L"MyAppName_MyAppGUID", nCmdShow, NULL, NULL);
    }

    ...
}

 

The first parameter for these three methods is lpCmdLine and this is the entire command line buffer.

The Start method in particular is the one that we are interested in. Because appenvstub.dll ends up calling msenv.dll, this means that we can use the same command line switches that when we execute devenv.exe, in fact our VS Shell application is at the end another msenv.dll caller. (same as devenv.exe)

So basically we can use:

  • MyApp.exe /Splash (to show the splash screen)
  • MyApp.exe /Log (to enable the application log)
  • MyApp.exe /NOVSIP (to test the SLK and PLKs)

 

 Pablo

posted on Thursday, November 22, 2007 6:01 AM by pga

# Help with using the VS2008 Shell @ Tuesday, November 27, 2007 4:48 AM

Pablo has written a series of posts that should be of help to anyone thinking of hosting their applications

Anonymous

# Help with using the VS2008 Shell @ Tuesday, November 27, 2007 5:46 AM

Pablo has written a series of posts that should be of help to anyone thinking of hosting their applications

Anonymous

# Pablo Galiano's VS Shell posts, in a nutshell @ Friday, December 14, 2007 4:12 PM

Pablo Galiano has a great ongoing series of technical blog posts on the new VS 2008 Shell . Links to

Anonymous

# Pablo Galiano's VS Shell posts, in a nutshell @ Friday, December 14, 2007 4:13 PM

Pablo Galiano has a great ongoing series of technical blog posts on the new VS 2008 Shell . Some of the

Anonymous