GetCurrentHwProfile (advapi32)
Last changed: -207.134.53.58

.

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

C# Signature:

[DllImport("advapi32.dll", SetLastError=true)]
  static extern bool GetCurrentHwProfile(IntPtr fProfile);

VB Signature:

User-Defined Types:

    [StructLayout(LayoutKind.Sequential)]
    class HWProfile
    {
    public Int32 dwDockInfo;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 39)]
    public string szHwProfileGuid;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
    public string szHwProfileName;
    }

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

        IntPtr lHWInfoPtr = Marshal.AllocHGlobal(123);
        HWProfile lProfile=new HWProfile();
        Marshal.StructureToPtr(lProfile,lHWInfoPtr,false);

        if (GetCurrentHwProfile(lHWInfoPtr)) {
        Marshal.PtrToStructure(lHWInfoPtr, lProfile);
        string lText=lProfile.szHwProfileGuid.ToString();
        }
        Marshal.FreeHGlobal(lHWInfoPtr);

Documentation