| |
|
|
| Bild aus Bilddateiinhalt im Speicher von Andreas Miethe: KompilierenMarkierenSeparieren
Proc CatchImage
Parameters MemPointer& ,Size&
Struct GdiplusStartupInput = GdiplusVersion&,DebugEventCallback&,SuppressBackgroundThread&,SuppressExternalCodecs&
Var GDIP& = ImportDll("Gdiplus.dll","")
Var OLE& = ImportDll("Ole32.dll","")
Var Kernel& = ImportDll("Kernel32.dll","")
Declare gdpsi#,gdiplusToken&,ImageObject&,GraphicObject&,pStream&,RetVal&
'GDIPlus starten
Dim gdpsi#,GdiplusStartupInput
gdpsi#.GdiplusVersion& = 1
gdpsi#.DebugEventCallback& = 0
gdpsi#.SuppressBackgroundThread& = 0
gdpsi#.SuppressExternalCodecs& = 0
GdiplusStartup(ADDR(gdiplusToken&),gdpsi#,0)
Dispose gdpsi#
'Speicher bereitstellen
Var m_hBuffer& = GlobalAlloc(2,Size&)
Var pBuffer& = GlobalLock(m_hBuffer&)
RtlMoveMemory(pBuffer&,MemPointer&,Size&)
GlobalUnlock(m_hBuffer&)
'Stream erzeugen
CreateStreamOnHGlobal(m_hBuffer&,1,Addr(pStream&))
GdipCreateBitmapFromStream(pStream&,Addr(ImageObject&))
'hBitmap erzeugen
GdipCreateHBITMAPFromBitmap(ImageObject&,Addr(RetVal&),0)
'aufräumen
Var Command& = Long(pStream&,0)
call(Long(Command&,8),pStream&)'IStream.Release
GlobalFree(m_hBuffer&)
GdipDisposeImage(ImageObject&)
GdipDeleteGraphics(GraphicObject&)
GdiplusShutdown(gdiplusToken&)
FreeDll GDIP&
FreeDll OLE&
FreeDll Kernel&
Return RetVal&
EndProc
|
|
|
| |
|
|