

GetCurrentHwProfile function

Retrieves information about the current hardware profile for the local computer.


BOOL WINAPI GetCurrentHwProfile(
  _Out_  LPHW_PROFILE_INFO lpHwProfileInfo


lpHwProfileInfo [out]

A pointer to an HW_PROFILE_INFO structure that receives information about the current hardware profile.

Return value




The GetCurrentHwProfile function retrieves the display name and globally unique identifier (GUID) string for the hardware profile. The function also retrieves the reported docking state for portable computers with docking stations.

The system generates a GUID for each hardware profile and stores it as a string in the registry. You can use GetCurrentHwProfile to retrieve the GUID string to use as a registry subkey under your application's configuration settings key in HKEY_CURRENT_USER. This enables you to store each user's settings for each hardware profile. For example, the Colors control panel application could use the subkey to store each user's color preferences for different hardware profiles, such as profiles for the docked and undocked states. Applications that use this functionality can check the current hardware profile when they start up, and update their settings accordingly.

Applications can also update their settings when a system device message, such as DBT_CONFIGCHANGED, indicates that the hardware profile has changed.

To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0400 or later. For more information, see Using the Windows Headers.


#include <windows.h>
#include <stdio.h>
#include <tchar.h>

void main(void) 
   HW_PROFILE_INFO   HwProfInfo;
   if (!GetCurrentHwProfile(&HwProfInfo)) 
      _tprintf(TEXT("GetCurrentHwProfile failed with error %lx\n"), 
   _tprintf(TEXT("DockInfo = %d\n"), HwProfInfo.dwDockInfo);
   _tprintf(TEXT("Profile Guid = %s\n"), HwProfInfo.szHwProfileGuid);
   _tprintf(TEXT("Friendly Name = %s\n"), HwProfInfo.szHwProfileName);


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]


Winbase.h (include Windows.h)





Unicode and ANSI names

GetCurrentHwProfileW (Unicode) and GetCurrentHwProfileA (ANSI)

See also

System Information Functions



Community Additions

© 2014 Microsoft. All rights reserved.