Chinaunix首页 | 论坛 | 博客
  • 博客访问: 525405
  • 博文数量: 158
  • 博客积分: 4015
  • 博客等级: 上校
  • 技术积分: 1711
  • 用 户 组: 普通用户
  • 注册时间: 2009-01-27 14:00
文章分类

全部博文(158)

文章存档

2010年(71)

2009年(87)

我的朋友

分类: WINDOWS

2010-01-07 12:40:53

GetSystemMetrics不是一个GDI函数, 没有HDC的参数类型:
这是个函数的声明:

int WINAPI GetSystemMetrics(
  __in int nIndex
);

我们从《WINDOWS程序设计》看一下它的常用参数:

struct {
    int iIndex;
    TCHAR* szLabel;
    TCHAR* szDesc;
} sysmetric[] = {
    SM_CXSCREEN, TEXT("SM_CXSCREEN"), TEXT("screen width in pixels"),
        SM_CYSCREEN, TEXT("SM_CYSCREEN"), TEXT("screen height in pixels"),
        SM_CXVSCROLL, TEXT("SM_CXVSCROLL"), TEXT("vertical scroll width"),
        SM_CYHSCROLL, TEXT("SM_CYHSCROLL"), TEXT("horizontal scroll height"),
        SM_CYCAPTION, TEXT("SM_CYCAPTION"), TEXT("caption bar height"),
        SM_CXICON, TEXT("SM_CXICON"), TEXT("icon width"),
        SM_CYICON, TEXT("SM_CYICON"), TEXT("icon height"),
        SM_CXCURSOR, TEXT("SM_CXCURSOR"), TEXT("cursor width"),
        SM_CYCURSOR, TEXT("SM_CYCURSOR"), TEXT("cursor height"),
        SM_CXFULLSCREEN, TEXT("SM_CXFULLSCREEN"), TEXT("full screen width"),
        SM_CYFULLSCREEN, TEXT("SM_CYFULLSCREEN"), TEXT("full screen height")
};

而GetDeviceCaps是一个GDI函数, 看一下它的声明:

int GetDeviceCaps(
  __in HDC hdc,
  __in int nIndex
);

看一下它的常用参数, 第一个肯定是hdc了:

struct {
    int iIndex;
    TCHAR* szLabel;
    TCHAR* szDesc;
} dev[] = {
    HORZSIZE, TEXT("HORZSIZE"), TEXT("screent width in mm"),
        VERTSIZE, TEXT("VERTSIZE"), TEXT("screen height in mm"),
        HORZRES, TEXT("HORZRES"), TEXT("screen width in pixels"),
        VERTRES, TEXT("VERTRES"), TEXT("screen height in pixels"),
        BITSPIXEL, TEXT("BITSPIXEL"), TEXT("color bits for every pixel"),
        PLANES, TEXT("PLANES"), TEXT("number of color planes"),
        LOGPIXELSX, TEXT("LOGPIXELSX"), TEXT("horizontal dots per inch"),
        LOGPIXELSY, TEXT("LOGPIXELSY"), TEXT("vertical dots per inch")
};

我们可以看到, 他们两者一些相似的地方, 比如说SM_CXSCREEN与HORZRES等等, 返回的都是屏幕宽度的像素值。
阅读(1223) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~