Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Win GDI函数CreateDIBDC在x64平台上无法正常工作_C_64 Bit_Gdi_Porting - Fatal编程技术网

Win GDI函数CreateDIBDC在x64平台上无法正常工作

Win GDI函数CreateDIBDC在x64平台上无法正常工作,c,64-bit,gdi,porting,C,64 Bit,Gdi,Porting,我有一个要移植到x64平台的静态win32 dll代码。。有许多函数正在使用Windows GDI函数,如CreateDIBDC、CreatePen等 问题是,在x86上处理DLL函数时,我在使用Windows API时从未遇到过任何问题。但是,在将代码移植到x64时,windows API正在产生问题 dll的功能主要处理位图图像的图像处理。从而利用windows的BitMapInfo头、位图等结构 有急事,请帮忙 -------加成 WindowVar = GetActiveWindow()

我有一个要移植到x64平台的静态win32 dll代码。。有许多函数正在使用Windows GDI函数,如CreateDIBDC、CreatePen等

问题是,在x86上处理DLL函数时,我在使用Windows API时从未遇到过任何问题。但是,在将代码移植到x64时,windows API正在产生问题

dll的功能主要处理位图图像的图像处理。从而利用windows的BitMapInfo头、位图等结构

有急事,请帮忙

-------加成

WindowVar = GetActiveWindow();
DisplayDeviceContext = GetDC(WindowVar);
BitmapVar = CreateDIBSection (DisplayDeviceContext, BITMAPINFOheaderstructure,
    COLORmap, &lpvBits, 0, 0L);
//copy data to the BitmapVar from image
byteswritten = GetObject(BitmapVar, sizeof(DIBSECTION), &DibSectionvar);

但主要的问题是,在x86上工作时,GetObject函数GetObject给出的字节数写为84,这是正确的,但在x64上它只给出32。然而,这一定是92…

无论如何,我得到了答案。这是一个棘手的问题。这种结构的尺寸不太合适。最后,我将sizeof(DIBSECTION)作为一个变量,并将其作为输入传递给函数。不知道为什么,但它解决了问题。

值得一提的是,我对x64也有同样的问题

以下调用返回的大小不同,
test=28
test2=32

需要将大小四舍五入到4字节边界。似乎与32位无关,但与x64无关

int test = sizeof(BITMAP);
int test2 = GetObject(hExportBitmap, sizeof(BITMAP), NULL);

用重新创建问题的最小示例程序或片段编辑您的问题。还包括来自编译器和操作系统的所有错误消息和警告。