AccusoftImagXpress13 ActiveX DLL > ImagXpress Object : CopyDIB Method |
Visual Basic |
---|
Public Function CopyDIB() As Long |
This method does not work with high-gray images as high-gray images cannot be DIBs by definition. Instead, use the CopyImage method to copy high-gray images.
If this method fails, in addition to the return value being zero, the ImagError property will have one of the following values: IX_Error_MemoryAlloc, IX_Error_NoImage, IX_Error_InvalidFormat, or IX_Error_NoCurrentBuffer.
Note that the receiver is responsible for freeing the DIB by issuing a GlobalFree on the DIB Handle. If the receiver is an ImagXpress control with the OwnDib property set to true, there is no need to issue the GlobalFree as ImagXpress does this for you.
HANDLEhDib=NULL; hDib=ImagXpress1.CopyDIB(); if(hDib!=NULL) { //Do something on my own with the hDib PBYTE pDib=::GlobalLock(hDib); if(pDib!=NULL) { PBITMAPINFOHEADER pBmi=(PBITMAPINFOHEADER) pDib; //Locked Dib, process it... ::GlobalUnlock(hDib); } ::GlobalFree(hDib); }
'The CopyDIB method is typically used to create 'a copy of a DIB for another ImagXpress control. 'ImagXpress2 will own the copied DIB or other 'clean-up is necessary. ImagXpress2.OwnDIB=True ImagXpress2.hDIB=ImagXpress1.CopyDIB