minigui:获取屏幕分辨率(GetGDCapability)

本文介绍了在MiniGUI环境下如何使用GetGDCapability函数来获取屏幕分辨率等参数的方法。通过设置不同iItem值,可以获取包括屏幕宽度、高度、颜色数等在内的多种设备上下文属性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

MiniGUI下获取屏幕分辨率用
unsigned int GetGDCapability (HDC hdc, int iItem)

// 屏幕宽度
int screen_width = GetGDCapability(HDC_SCREEN,GDCAP_HPIXEL);
// 屏幕高度
int screen_height =GetGDCapability(HDC_SCREEN,GDCAP_VPIXEL);

GetGDCapability 用于返回HDC的参数,如果hdc参数为HDC_SCREEN,返回的就是屏幕DC的相关参数,不同的iItem值返回不同的参数:

GDCAP_COLORNUM
Tell GetGDCapability to return the colors number of the DC. Note the for a DC with 32-bit depth, the function will return 0xFFFFFFFF, not 0x100000000.
GDCAP_HPIXEL
Tell GetGCapability to return the horizontal resolution of the DC.
GDCAP_VPIXEL
Tell GetGDCapability to return the vertical resolution of the DC.
GDCAP_MAXX
Tell GetGDCapability to return the maximal visible x value of the DC.
GDCAP_MAXY
Tell GetGDCapability to return the maximal visible y value of the DC.
GDCAP_DEPTH
Tell GetGDCapability to return the color depth of the DC. The returned value can be 1, 4, 8, 15, 16, 24, or 32.
GDCAP_BITSPP
Tell GetGDCapability to return the bits number for storing a pixle in the DC.
GDCAP_BPP
Tell GetGDCapability to return the bytes number for storing a pixle in the DC.
GDCAP_RMASK
Tell GetGDCapability to return the pixel red color mask for the DC.
GDCAP_GMASK
Tell GetGDCapability to return the pixel green color mask for the DC.
GDCAP_BMASK
Tell GetGDCapability to return the pixel blue color mask for the DC.
GDCAP_AMASK
Tell GetGDCapability to return the pixel alpha color mask for the DC.
GDCAP_PITCH
Tell GetGDCapability to return the pitch (the bytes of one scan line) of the DC.

官方API说明参见:
http://www.minigui.com/api_ref/3.0.12_processes/group__dc__fns.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

10km

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值