1.首先判断是否为Win 10系统:这个需要添加Version.lib 库
BOOL IsFileVersionWindows10OrGreater()//判断是否为Win10系统,Version.lib需要添加
{
DWORD dwVerInfoSize = GetFileVersionInfoSizeW(L"kernel32.dll", NULL);
if (0 != dwVerInfoSize)
{
LPWSTR pszBuffer = (LPWSTR)_alloca(dwVerInfoSize * sizeof(WCHAR));
if (TRUE == GetFileVersionInfoW(L"kernel32.dll", 0, dwVerInfoSize, pszBuffer))
{
VS_FIXEDFILEINFO* pVsInfo = NULL;
UINT nFileInfoSize = sizeof(VS_FIXEDFILEINFO);
if (TRUE == VerQueryValueW(pszBuffer, L"\\", (void**)&pVsInfo, &nFileInfoSize))
{
printf("%d.%d.%d.%d\n", HIWORD(pVsInfo->dwFileVersionMS), LOWORD(pVsInfo->dwFileVersionMS), HIWORD(pVsInfo->dwFileVersionLS), LOWORD(pVsInfo->dwFileVersionLS));
if (HIWORD(pVsInfo->dwFileVersionMS) >= 10)
{
return TRUE;
}
}
}
}
return FALSE;
}
2. 发送放大镜的快捷键即可打开放大镜
if (IsFileVersionWindows10OrGreater())
{
//Win10 fasong Win++//放大镜
//MessageBox("请按“WIN窗”和“+”键一起按下");
keybd_event(VK_LWIN, 0, 0, 0);
keybd_event(VK_ADD, 0, 0, 0);
keybd_event(VK_ADD, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
}
3.效果如下:win10 自带的放大镜功能