#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);
}
#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);
}
#define _WIN32_WINNT 0x0400
1.HW_PROFILE_INFO 没有定义
2.GetCurrentHwProfile 没有定义
或
1.error LNK2001: unresolved external symbol "__declspec(dllimport) int __stdcall GetCurrentHwProfileA(struct tagHW_PROFILE_INFOA *)" (__imp_?GetCurrentHwProfileA@@YGHPAUtagHW_PROFILE_INFOA@@@Z)
还是报同样的错
但没有link错误,在什么情况下有link错?
windows.h中已经include <winbase.h>了
的下面加上:
#define _WIN32_WINNT 0x0400然后rebuild all就可以了
[email protected]
#include <windows.h>
#include <winbase.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);
}