Zitat:
Get ( ImgInfo As Info, Left As Long, Top As Long, Width As Long, Height As Long, [DstWidth], [DstHeight] ) As Variant
This method is used to export a rectangular area of the image into a buffer available to the application. The Left, Top, Width, Height parameters specify the source rectangular area. When all parameters are zero (0), the whole image will be exported. The function stretches or compresses the area if necessary to fit the dimensions specified by the DstWidth and DstHeight parameters for the destination. The type of the optional parameters is Long; when they are not specified, the destination size will be equal to the original size. The applied stretching mode will be influenced by the Stretch property of the Document object. The line order, the padding and – for 24-bit color images – the RGBorder attributes of the retrieved image can be controlled by the LineOrder, Padding and RGBOrder properties of the Document object.
The basic attributes of the exported image are returned in the ImgInfo parameter.
The exported bitmap is returned as a Variant containing a SAFEARRAY of bytes (a Byte array in Visual Basic). To free the returned Variant in C++, use the VariantClear
Win32 API function or set the Variant to Empty in Visual Basic. It is recommended to check the type of the returned bitmap (BitsPerPixel property of the Info object), since it is not guaranteed, that it will be the same as for the original image.
dies ist ein auszug aus einer hilfedatei, das beispiel ist aber wie man sieht für vb.
ich habe eine typelibrary vorliegen und will nun aus dem olevariant, welches ich über get() bekomme, in dem die bilddaten in einem array vorhanden sind in ein bitmap laden um dieses dann anzuzeigen....
hat da jemand eine idee?
Delphi-Quellcode:
procedure Tmainform.ConvertOleVarianttoBitmap(Data : OleVariant);
var
ms : TMemoryStream;
p : Pointer;
MyBitmap : TBitmap;
begin
ms:=TMemoryStream.Create;
p:=VarArrayLock(Data);
try
ms.Write(p^,VarArrayHighBound(Data,1)+1);
finally
VarArrayUnlock(Data);
end;
ms.seek(0,soFromBeginning);
myBitmap:=TBitmap.Create;
myBitmap.LoadFromStream(ms);
image.Picture.Assign(myBitmap);
ms.Free;
myBitmap.Free;
end;
funktionert nicht, da der header des bitmap nicht ok ist. es kommt ne unschöne fehlermeldung.