IC Imaging Control ActiveX

ICImagingControl.MemoryGetDib Method

ICImagingControl.MemoryGetDib Method

This method is used to pass a Device Independent Bitmap to other programming tools for further processing.
Public Function MemoryGetDib() As Long
Return Value:

A handle to a Device Independent Bitmap (DIB).


If the LiveStart method has not been called, MemorySnapImage builds a filtergraph on its own whenever MemorySnapImage is called. If MemorySnapImage is called more than once, it is suggested to call LiveStart before calling MemorySnapImage.

This frees MemorySnapImage from initialization tasks it would otherwise have to perform each time it is called.

MemoryGetDib allocates global memory every time it is called. This memory is not released, because this would release the DIB in the other programming tools. So calling MemoryGetDib too often would cause an out of memory error. To prevent running out of memory an application needs to free this memory.

A global variable PicMemPointer needs to be added to the form:

Dim PicMemPointer As Long

The Windows function GlobalFree() frees global memory. It is implemented in kernel32.lib. The GlobalFree() function needs to be declared as follows in the form:

Private Declare Function GlobalFree Lib "kernel32" _
                         (ByVal hMem As Long) As Long

The example must be extended to:

Private Sub cmdLead_Click()
    GlobalFree PicMemPointer
    PicMemPointer = ICImagingControl1.MemoryGetDib
    Form1.LEAD1.SetDIB PicMemPointer
End Sub

This example snaps an image and passes it to a Leadtools control:

Private Sub cmdLead_Click()
    Form1.LEAD1.SetDIB ICImagingControl1.MemoryGetDib
End Sub

Note that Leadtools is not a product of The Imaging Source and is not shipped with IC Imaging Control.

See also: ICImagingControl, ICImagingControl.MemoryGetImageData

<< ICImagingControl

Get in touch with us

About The Imaging Source

Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, frame grabbers and video converters for production automation, quality assurance, logistics, medicine, science and security.

Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.

Automated Imaging Association ISO 9001:2015 certified

Contact us