在net中如何调用Win32 API : GetBitmapBits

cwbboy 2005-07-13 09:53:32

1、 在net中如何调用GetBitmapBits?我试过n次都出错。

2、 另外,想请问一下通过GetBitMapBits取得的一个位图的颜色信息与我直接通过IO操作取得该位图文件的流的字节数组是否是一样的?
--------------------------
GetBitmapBits的定义如下:

LONG GetBitmapBits(
HBITMAP hbmp, // handle to bitmap
LONG cbBuffer, // number of bytes to copy
LPVOID lpvBits // buffer to receive bits
);

Parameters
hbmp
[in] Handle to the device-dependent bitmap.
cbBuffer
[in] Specifies the number of bytes to copy from the bitmap into the buffer.
lpvBits
[out] Pointer to a buffer to receive the bitmap bits. The bits are stored as an array of byte values.
---------------------------
...全文
161 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
silverseven7 2005-07-13
  • 打赏
  • 举报
回复
bitsbird(一瓢 闭关) ( ) 信bitsbird(一瓢 闭关) ( ) 信
right
bitsbird 2005-07-13
  • 打赏
  • 举报
回复
[System.Runtime.InteropServices.DllImport("gdi32")]
static extern int GetBitmapBits(int hBitmap, int dwCount, ref object lpBits);
cwbboy 2005-07-13
  • 打赏
  • 举报
回复
up
cwbboy 2005-07-13
  • 打赏
  • 举报
回复
你那种方法我得不到字节数组。
cwbboy 2005-07-13
  • 打赏
  • 举报
回复
lpvBits 应该是一个字节数组啊,你一个整型我怎么用啊?
weixing979 2005-07-13
  • 打赏
  • 举报
回复
[DllImport("gdi32.dll", EntryPoint="GetBitmapBits")]
public static extern int GetBitmapBits (
int hBitmap,
int dwCount,
ref int lpBits
);

这样试一下
sfanpu 2005-07-13
  • 打赏
  • 举报
回复
参考这个:

http://www.microsoft.com/china/msdn/library/langtool/vcsharp/ousNET.mspx

110,532

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧