Page 1 of 1

DIB-Pointer from VintasoftImage

Posted: Thu Oct 08, 2015 5:55 pm
by DanielLW
Hello,

i have an external process which takes an Int-Pointer to a Windows Device Independent Bitmap (DIB) as a parameter.

Is it possible to get the DIB from a VintasoftImage and the int-pointer to it? I've found the DibFile and DibPage classes, but it seems there are no properties or methods to get the int pointer.

Can this somehow be accomplished?

Thank you.

Re: DIB-Pointer from VintasoftImage

Posted: Fri Oct 09, 2015 10:28 am
by Yuri
Hello Daniel,

Yes, please try to use the following code:

Code: Select all

[System.Runtime.InteropServices.DllImport("gdi32.dll")]
public static extern bool DeleteObject(IntPtr hObject);


VintasoftImage image = ...;
// create bitmap form VintasoftImage
using (Bitmap bitmap = image.GetAsBitmap())
{
    // create a GDI bitmap object from bitmap
    IntPtr hBitmap = bitmap.GetHbitmap();

    // ...
    // do something with hBitmap
    // ...
    
    // delete GDI object and free memory
    DeleteObject(hBitmap);
}
--
Sincerely,
Yuri

Re: DIB-Pointer from VintasoftImage

Posted: Fri Oct 09, 2015 10:45 am
by DanielLW
Perfect, thank you!