{ Tony Domigan : http://www.domaj.com : 15Oct02 Using DXLIB save a director cast member bitmap in memberNum 0 of the internal cast to c:\dirpix.bmp. Note: 1. This code does no validation. A valid Bitmap is assumed to be available in the first position of the internal cast. 2. This code is based on a code snippet provided by DelphiXTRA Any comments, suggestions or corrections to tony@domaj.com For all DXLIB support: http://www.delphixtra.com } unit exportCastBitmap; interface uses DXClasses, Windows, Graphics; type TexportBitmap=class(TDXScript) protected procedure ExecuteFunction(FunctionIndex:Cardinal; const ArgList:IDXArgList; const Result:IDXValue); override; public class procedure GetScriptInfo(var ScriptInfo:TDXScriptInfo); override; end; implementation const CLSID_Script:TGUID='{74C26EC1-E03B-11D6-9139-004F4900150E}'; class procedure TexportBitmap.GetScriptInfo(var ScriptInfo:TDXScriptInfo); begin ScriptInfo.MessageTable:='xtra exportBitmap'#10+ '* exportBitmap'#10; end; procedure TexportBitmap.ExecuteFunction(FunctionIndex:Cardinal; const ArgList:IDXArgList; const Result:IDXValue); procedure exportBitmap; var cast : IDXCast; member : IDXCastmember; // Our offscreen bitmap b : TBitmap; // the following values will be written to // by the GetBitmap function DC : HDC; bitmap : hBitmap; width, height : Integer; begin cast := movie.GetCastByIndex(1); //Internal Cast member := cast.CastMember[1]; // assume member 1 has bitmap b:=TBitmap.Create; //create an offscreen bitmap member.Media.GetBitmap(bitmap,DC,width,height);// create our references // point our offscreen bitmap to the dib in memory b.Handle:=bitmap; b.Canvas.Handle:=DC; try b.SaveToFile('c:\dirpix.bmp'); //Save to file finally b.Free; end; end; begin case FunctionIndex of 0: exportBitmap; end; end; initialization RegisterDXClass(TexportBitmap,CLSID_Script); end.