Click here to Skip to main content
13,288,121 members (54,037 online)
Click here to Skip to main content
Add your own
alternative version


8 bookmarked
Posted 20 Mar 2001

VS Service Pack

, 31 Mar 2001
Rate this:
Please Sign up or sign in to vote.
Visual Studio Add-In that displays the latest service pack installed


This is a simple add-in that allows you to quickly and easily find out which service pack you have installed for Visual Studio.

Creating the Add-in

Use the Visual C++ Add-in Wizard (specified in MDSN January 2001 in "Creating Add-ins Using Visual C++") to create an add-in:

  1. File --> New
  2. Projects
  3. Developer Studio Add-In Wizard
  4. type project name (VSSPVer) and click OK
  5. Let everything stay checked and click OK.
  6. Modify the default method name (both in interface and associated C++ class, definition and declaration) replacing it with the new name OnSPVersion.

The implementation looks like this:

STDMETHODIMP CCommands::OnSPVersion() 

    // TODO: Replace this with the actual code to execute this command
    //  Use m_pApplication to access the Developer Studio Application object,
    //  and VERIFY_OK to see error strings in DEBUG builds of your add-in
    //  (see stdafx.h)

    HKEY    hkVSSPVer    = NULL;
    LONG    lRetVal        = NO_ERROR;
    CString    strVersion;

    lRetVal = 
    if(lRetVal == NO_ERROR)
        DWORD dwType;
        lRetVal = RegQueryValueEx(hkVSSPVer, _T("latest"), NULL, &dwType, NULL, NULL);
        if((lRetVal == NO_ERROR) && (dwType == REG_DWORD))
            DWORD dwVSSPVersion = 0;
            DWORD dwDataLen        = sizeof(DWORD);

            lRetVal = ::RegQueryValueEx(hkVSSPVer, _T("latest"), NULL, 
                                        &dwType, (LPBYTE)&dwVSSPVersion, &dwDataLen);
            if(lRetVal == NO_ERROR)
                strVersion.Format(IDS_VSSPVER_VERSION, dwVSSPVersion);


    ::MessageBox(NULL, strVersion, _T("Microsoft Visual Studio"), 
                 MB_OK | MB_ICONINFORMATION);

    return S_OK;

That's it. Compile, register the DLL using regsvr32 and that's it. It will appear into menu Tools/Customize/Add-ins and macro files with the name "VSSPVer Developer Studio Add-in".


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Romania Romania
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralWon't work with VS6 SP3 Pin
Anonymous26-Mar-01 12:44
memberAnonymous26-Mar-01 12:44 
SP3 doesn't appear to write the "latest" DWORD value; instead it only writes a value named "sp3". The code needs to be updated to check for the "latest" value and if not found look for "sp4", "sp3", etc.

Very good idea BTW. MS should put this sort of information in the About box of EVERY application they write since it would make life a lot easier for system admins.
GeneralRe: Won't work with VS6 SP3 Pin
Anonymous14-May-01 2:21
memberAnonymous14-May-01 2:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171207.1 | Last Updated 1 Apr 2001
Article Copyright 2001 by Sardaukar
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid