search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

純C/C++ 呼叫WINAPI 取得系統DPI [CB_use_WinAPI_getDPI] – jashliao部落格

純C/C++ 呼叫WINAPI 取得系統DPI [CB_use_WinAPI_getDPI]


GITHUB: https://github.com/jash-git/CB_use_WinAPI_getDPI.git


CODE

#include 
#include 
//--
//Step_01
#define _WIN32_WINNT 0x0500//GetDC
#include 
//--

using namespace std;

//--
//Step_02
class Point
{
    public:
        int X;
        int Y;
        Point();
};
Point::Point()
{
    X=0;
    Y=0;
}
//--
static Point GetSystemDpi()
{
    Point result;
    HWND myconsole=GetConsoleWindow();
    HDC mydc = GetDC(myconsole);

    result.X = GetDeviceCaps(mydc, 88);//-lgdi32
    result.Y = GetDeviceCaps(mydc, 90);//-lgdi32

    ReleaseDC(myconsole,mydc);

    return result;
}
//--
void Pause()
{
    printf("Press Enter key to continue...");
    fgetc(stdin);
}
int main()
{
    Point result=GetSystemDpi();
    cout <


熱門推薦

本文由 jashliaoeuwordpress 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦