G
Geoff Tanaka
Hi, I have created a DIB in C# and I am having a problem using it in a
C++ DLL.
Basically I have a C++ DLL which requires a DIB handle to be passed
into it. I create the DIB using:
IntPtr myDIB = CreateDIBSection(hdc, pBitmapInfo, DIB_RGB_COLORS,
&pPixelSource, (IntPtr)0, (uint);
I can put the myDIB into the function and it will compile, but when the
code runs it returns a NullReferenceException. I have tried to get some
help with this matter and the only advice that I have gotten was that I
may not be getting the proper handle back from CreateDIBSection. Some
suggestions were to dereference the myDIB when passing it into the dll
function. I tried using myDIB.ToPointer() (though I'm not sure I was
using it properly) and even just going &myDIB. Neither of these have
worked. Does anyone know what I need to do to pass in the correct
handle?
C++ DLL.
Basically I have a C++ DLL which requires a DIB handle to be passed
into it. I create the DIB using:
IntPtr myDIB = CreateDIBSection(hdc, pBitmapInfo, DIB_RGB_COLORS,
&pPixelSource, (IntPtr)0, (uint);
I can put the myDIB into the function and it will compile, but when the
code runs it returns a NullReferenceException. I have tried to get some
help with this matter and the only advice that I have gotten was that I
may not be getting the proper handle back from CreateDIBSection. Some
suggestions were to dereference the myDIB when passing it into the dll
function. I tried using myDIB.ToPointer() (though I'm not sure I was
using it properly) and even just going &myDIB. Neither of these have
worked. Does anyone know what I need to do to pass in the correct
handle?