3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
純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提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦