Win GDI 函数 CreateDIBDC 在 x64 平台上无法正常工作
我有一个要移植到 x64 平台的静态 win32 dll 代码..有许多函数正在使用 Windows GDI 函数,如 CreateDIBDC、CreatePen 等......
问题是在 x86 上处理 DLL 的函数时,我在使用 Windows API 时从未遇到过任何问题。但是在将代码移植到 x64 时,Windows API 产生了问题....
dll 的功能基本上处理位图图像的图像处理。从而利用windows的bitmapinfoheader、bitmap等结构...
请帮忙,因为它很紧急。
--------补充
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...
I have a static win32 dll code that is to be ported to x64 platform.. there are many functions that are using Windows GDI functions like CreateDIBDC, CreatePen, etc....
The problem is that while processing the functions of the DLL on x86, I have never faced any problem using the Windows APIs. But while porting the code to x64, the windows APIs are creating problems....
The functions of the dll basically deal with image processing on Bitmap images. thus making use of bitmapinfoheader, bitmap, etc structures of windows...
please help as it is urgent.
-------addition
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);
but the main problem is that while working on x86, the GetObject function GetObject gives byteswritten as 84, which is correct but on x64 it gives only 32. however this must be 92...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
无论如何我得到了答案。这是一个奇怪的问题。 DIBSECTION 结构的大小不正确。所以最后我将 sizeof(DIBSECTION) 传递给一个变量并将其作为函数的输入传递。不知道为什么,但它解决了问题。
I got the answer anyhow. It was a wierd problem. The size of DIBSECTION structure was not coming out to be right. so finally i took sizeof(DIBSECTION) to a variable and passed it as input to the function. dont know why but it solved the problem.
无论如何,我在 x64 上也遇到了同样的问题。
以下调用返回的大小不同,
test = 28
、test2 = 32
。需要将大小四舍五入到 4 字节边界。对于 32 位似乎不重要,但对于 x64 则重要
For what it's worth I have had the same problem with x64 .
The sizes returned by the following calls are different ,
test = 28
,test2 = 32
.Need to round up size to a 4 byte boundary . Doesn't seem to matter with 32 bit but does with x64