V
vvsarun
Hi,
i wants to use GetBitmapBits and SetBitmapBits functions with my
Bitmap object in C#.
i have imported above said functions from GDI32.dll.
GetBitmapBits is working fine and i was able to get all the bits of
the bitmap. Then i have updated the bits and called SetBitmapBits to
update the bitmap. But is not working. What might be the reason? how
can i make it work with Bitmap class?
Code.. here SetBitmapBits is not working...
Bitmap bmp =
System.Drawing.Image.FromHbitmap(hBitmap);
byte [] bitmapbits = new
byte[Form1.ActiveForm.Width*Form1.ActiveForm.Height];
int numBits = (Form1.ActiveForm.Width *
Form1.ActiveForm.Height);
int numbits = MFCLIB.GetBitmapBits(hBitmap,numBits ,
bitmapbits);
for (int intCounter = 1; intCounter <= 5000; intCounter
++)
{
byte val = bitmapbits[intCounter];
if (val == 0)
{
bitmapbits[intCounter] = 30;
}
}
uint numb = (uint)numbits;
numbits = MFCLIB.SetBitmapBits(hBitmap, numb,
bitmapbits);
MFCLIB.SelectObject((IntPtr)memDC, hBitmap);
i wants to use GetBitmapBits and SetBitmapBits functions with my
Bitmap object in C#.
i have imported above said functions from GDI32.dll.
GetBitmapBits is working fine and i was able to get all the bits of
the bitmap. Then i have updated the bits and called SetBitmapBits to
update the bitmap. But is not working. What might be the reason? how
can i make it work with Bitmap class?
Code.. here SetBitmapBits is not working...
Bitmap bmp =
System.Drawing.Image.FromHbitmap(hBitmap);
byte [] bitmapbits = new
byte[Form1.ActiveForm.Width*Form1.ActiveForm.Height];
int numBits = (Form1.ActiveForm.Width *
Form1.ActiveForm.Height);
int numbits = MFCLIB.GetBitmapBits(hBitmap,numBits ,
bitmapbits);
for (int intCounter = 1; intCounter <= 5000; intCounter
++)
{
byte val = bitmapbits[intCounter];
if (val == 0)
{
bitmapbits[intCounter] = 30;
}
}
uint numb = (uint)numbits;
numbits = MFCLIB.SetBitmapBits(hBitmap, numb,
bitmapbits);
MFCLIB.SelectObject((IntPtr)memDC, hBitmap);