【发布时间】:2016-10-26 07:37:38
【问题描述】:
我只给你关于我的问题的行。我不知道为什么这不能编译:
POINT ptVertex[5];
ptVertex[0].x = 180;
ptVertex[0].y = 80;
ptVertex[1].x = 100;
ptVertex[1].y = 160;
ptVertex[2].x = 120;
ptVertex[2].y = 260;
ptVertex[3].x = 240;
ptVertex[3].y = 260;
ptVertex[4].x = 260;
ptVertex[4].y = 160;
CreatePolygonRgn( &ptVertex, 5, ALTERNATE )
我在 DevC++ TDM GCC 64bits 上编译,错误是:
无法将参数 '1' 的 'POINT ()[5] {aka tagPOINT ()[5]}' 转换为 'const POINT* {aka const tagPOINT*}' 到 'HRGN__* CreatePolygonRgn(const POINT*, int, int)'
如果有人能发现我的错误。谢谢。
【问题讨论】:
-
提供minimal reproducible example。并选择两种不同语言 C 或 C++ 中的一种!
-
函数
CreatePolygonRgn的签名是什么?即它的声明是什么? -
这是签名:WINGDIAPI HRGN WINAPI CreatePolygonRgn( CONST POINT * pptl, int cPoint, int iMode )
-
做
CreatePolygonRgn( ptVertex, 5, ALTERNATE )。这样,您将传递第一个元素的地址而不是数组的地址(相同的值但不同的类型)。