PDA

View Full Version : Some help with 'MemoryGetDib' wanted please



Unregistered
July 26, 2002, 08:41:33
I want to use the MemoryGetDib method so I can transfer an image to a dll for furher processing. The way I see it is that the MemoryGetDIB method gives us a handle, and using GlobalLock I get a pointer to the bitmapinfoheader of a DIB. Since it doesn't work for me I tried the following in Visual Basic.
(only the relevant code is shown...)

dim Dest as BITMAPINFOHEADER
dim PicMemHandle as long
dim PicMemPointer as long

ICImagingControl1.MemorySnapImage
PicMemHandle = ICImagingControl1.MemoryGetDib
PicMemPointer = GlobalLock(PicMemHandle)
CopyMemory Dest, PicMemPointer, Len(Dest)

MsgBox Str$(dest.biSize)

-------
So I thought that the messagebox would show '40' which is the size of the bitmapinfoheader but it displays some big number. Am I missing something?

Thanks for the help


This message was originally posted by Thierry Vanmarcke in the old IC Imaging Control Support Forum.

Unregistered
July 26, 2002, 11:18:40
Hello,

Your problem is the "CopyMemory" statement.
The declaration of "CopyMemory" is

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(pDst As Any, pSrc As Any, ByVal ByteLen As Long)


So the statement for "CopyMemory" is:

CopyMemory Dest, ByVal PicMemPointer, Len(Dest)

The PicMemPointer needs to used "ByVal".

Best regards
IC Support


This message was originally posted by IC Support in the old IC Imaging Control Support Forum.

Unregistered
July 26, 2002, 15:43:02
Stupid me ;-)

Thanks and have a nice weekend


This message was originally posted by Thierry Vanmarcke in the old IC Imaging Control Support Forum.