Visual Studio Express 2005 and the Platform SDK


Installation
1. Download and install Visual C++ Express 2005.
2. Download and install the Windows Server 2003 R2 Platform SDK or web install
Note: The PSDK default location is C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2, we will refer to it as C:\Program Files\MS_PSDK
3. To enable windows.h and other typical windows development APIs in Visual C++ Express go to
Tools > Options > Projects and Solutions > VC++ Directories and set the following:
Executable files: C:\Program Files\MS_Platform_SDK\Bin
Include files: C:\Program Files\MS_Platform_SDK\Include
Library files: C:\Program Files\MS_Platform_SDK\Lib

4. In a notepad, open C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaultscorewin_express.vsprops
add the following to AdditionalDependencies: " user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"
5. Enable the win32 api in the project setup wizard, open this file in Notepad
C:\Program Files\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033\AppSettings.htm
comment out the following lines (after IS_EXPRESS_SKU) as follows (approx line #440)
// WIN_APP.disabled = true;
// WIN_APP_LABEL.disabled = true;
// DLL_APP.disabled = true;
// DLL_APP_LABEL.disabled = true;


test project 1 - console
Test your configuration by compiling and running the following application:
Set it up as a Win32 Console Project (right before you click [Finish], click Application Settings and select console application).
#include <windows.h>
#include <tchar.h>
#include <shellapi.h>
 
int _tmain(int argc, _TCHAR* argv[])
{
    ShellExecute(NULL, _T("open"), _T("http://www.google.com"), NULL, NULL, SW_SHOW);
    return 0;
}

test project 2 - win32 gui
Set this one up as a Win32 Console Project at first but later choose windows application (right before you click [Finish], click Application Settings and select windows application).

If you don't select 'windows application' and do console again, you will want to go to
Project > Project Properties > Configuration Properties > Linker > System and set 'Subsystem' to "Windows (/SUBSYSTEM:WINDOWS)" in the dropdown, because you are using win32 api gui elements, and WinMain() instead of main().
#include <windows.h>
#include <tchar.h>
 
#define WIN32_LEAN_AND_MEAN          
 
int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
  //create the main window
  CreateWindowEx(  
    0,
    WC_DIALOG, //predefined const WC_DIALOG for dialog boxes
    _T("My Window"), // title text of the window
    WS_OVERLAPPEDWINDOW | WS_VISIBLE, // style
    400, // x
    100, // x
    200, // w
    200, // h
    NULL, // parent window handle -  NULL
    NULL, //  
    NULL, //  
    NULL  //  
  );
 
  //display a message box
  MessageBox(
    NULL, // parent window handle - NULL
    _T("Message - Hello World"),
    _T("Title of Message Box"),  
    0 // style
  );
  return 0;
}

Deploy Your Application
To deploy an application, the client will need to download
vcredist_x86.exe for Visual C++ Express 2005 SP1. Then the client should be able to run any .exe you have compiled.
code snippets are licensed under Creative Commons CC-By-SA 3.0 (unless otherwise specified)