I would like to make a Windows Desktop application that is checking the hardware ID of currently used PC. I'm using VS2019 and created a "CLR Empty Project (.NET Framework)". I created a new C++ file with exemplary code available on learn.microsoft:
#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"),
GetLastError());
return;
}
_tprintf(TEXT("DockInfo = %d\n"), HwProfInfo.dwDockInfo);
_tprintf(TEXT("Profile Guid = %s\n"), HwProfInfo.szHwProfileGuid);
_tprintf(TEXT("Friendly Name = %s\n"), HwProfInfo.szHwProfileName);
}
Then I get the problems in this image: Error Message When I do the same with an "Empty C++ Project" everything works as expected.
I would be really happy if someone could explain what's the problem and how to solve this. Thanks!
Andy