Элемент пока не ставил - завтра
Вот контр-пример для пакетной обработки
Add(MainForm,7649955,126,84) { Left=10 Top=10 Width=475 Height=444 Position=1 } Add(InlineCode,13555273,308,91) { WorkPoints=#6:doDraw|6:doLoad| EventPoints=#6:onLoad| DataPoints=#8:FileName|6:Bitmap| Code=#15:unit HiAsmUnit;|0:|9:interface|0:|56:uses Windows,Messages,Share,Debug,ActiveX,KOLComObj,KOL;|0:|4:type|32: IImgCtx = interface(IUnknown)|48: ['{3050f3d7-98b5-11cf-bb82-00aa00bdce0b}']|40: // Initialization/Download methods|68: function Load(pszUrl:PWChar; dwFlags:DWORD): HResult; stdcall;|93: function SelectChanges(ulChgOn:DWORD; ulChgOff:DWORD; fSignal:DWORD): HResult; stdcall;|83: function SetCallback(pCallback:pointer; pUserData:pointer): HResult; stdcall;|44: function Disconnect: HResult; stdcall;|0:|22: // Query methods|95: function GetUpdateRects(prc:PRect; var prcImg:TRect; var pcrc:integer): HResult; stdcall;|104: function GetStateInfo(var pulState:DWORD; var pSize:TSize; fClearChanges:DWORD): HResult; stdcall;|64: function GetPalette(var phpal:HPalette): HResult; stdcall;|0:|26: // Rendering methods|69: function Draw(_hdc:HDC; var prcBounds:TRect): HResult; stdcall;|107: function Tile(_hdc:HDC; var pptBackOrg:TPoint; var prcClip:TRect; var psize:TSize): HResult; stdcall;|120: function StretchBlt(_hdc:HDC; dstX,dstY,dstXE,dstYE,srcX,srcY,srcXE,srcYE:integer; dwROP:DWORD): HResult; stdcall;|5: end;|0:|28: THiAsmClass = class(TDebug)|10: private|21: FImgCtx:IImgCtx;|16: sg:boolean;|14: sz:TSize;|9: public|38: FileName,Bitmap,onLoad:THI_Event;|47: procedure doLoad(var Data:TData;idx:word);|47: procedure doDraw(var Data:TData;idx:word);|5: end;|0:|14:implementation|0:|5:const|31: IMGCHG_SIZE = $0001;|31: IMGCHG_VIEW = $0002;|31: IMGCHG_COMPLETE = $0004;|31: IMGCHG_ANIMATE = $0008;|31: IMGCHG_MASK = $000F;|0:|35: IMGLOAD_NOTLOADED = $00100000;|35: IMGLOAD_LOADING = $00200000;|35: IMGLOAD_STOPPED = $00400000;|35: IMGLOAD_ERROR = $00800000;|35: IMGLOAD_COMPLETE = $01000000;|35: IMGLOAD_MASK = $01F00000;|0:|35: IMGBITS_NONE = $02000000;|35: IMGBITS_PARTIAL = $04000000;|35: IMGBITS_TOTAL = $08000000;|35: IMGBITS_MASK = $0E000000;|0:|35: IMGANIM_ANIMATED = $10000000;|35: IMGANIM_MASK = $10000000;|0:|35: IMGTRANS_OPAQUE = $20000000;|35: IMGTRANS_MASK = $20000000;|0:|35: DWN_COLORMODE = $0000003F;|35: DWN_DOWNLOADONLY = $00000040;|35: DWN_FORCEDITHER = $00000080;|35: DWN_RAWIMAGE = $00000100;|0:|66: CLSID_IImgCtx:TGUID = '{3050f3d6-98b5-11cf-bb82-00aa00bdce0b}';|66: IID_IImgCtx:TGUID = '{3050f3d7-98b5-11cf-bb82-00aa00bdce0b}';|0:|0:|22:{ StringToWideString }|73:function StringToWideString(const s: String; codePage: Word): WideString;|17:var l: integer;|5:begin|16: Result := '';|23: if s = '' then exit;|80: l := MultiByteToWideChar(codePage, MB_PRECOMPOSED, PChar(@s[1]), -1, nil, 0);|28: SetLength(Result, l - 1);|23: if l <= 1 then exit;|93: MultiByteToWideChar(CodePage, MB_PRECOMPOSED, PChar(@s[1]), -1, PWideChar(@Result[1]), l);|4:end;|0:|63:procedure MyCallback(pCtx:pointer; pUserData:pointer); stdcall;|15:var stat:dword;|5:begin|39: with THiAsmClass(pUserData) do begin|14: sg := true;|37: FImgCtx.GetStateInfo(stat, sz, 0);|23: _hi_onEvent(onLoad);|6: end;|4:end;|0:|29:procedure THiAsmClass.doDraw;|25:var R:TRect; bmp:PBitmap;|5:begin|23: if not sg then exit;|34: bmp := ReadBitmap(Data,Bitmap);|43: R := MakeRect(0,0,bmp.Width,bmp.Height);|37: FImgCtx.Draw(bmp.Canvas.Handle,R);|4:end;|0:|29:procedure THiAsmClass.doLoad;|37:var s,s1:string; len:dword; fn:pchar;|5:begin|15: sg := false;|35: s1 := ReadString(Data,FileName);|43: len := GetFullPathName(@s1[1],0,nil,fn);|22: setlength(s,len-1);|43: GetFullPathName(@s1[1], len, @s[1], fn);|34: if not FileExists(s) then exit;|56: FImgCtx := CreateComObject(CLSID_IImgCtx) as IImgCtx;|52: FImgCtx.Load(PWChar(StringToWideString(s,3)), 0);|56: FImgCtx.SetCallback(@MyCallback, pointer(Self)); |46: FImgCtx.SelectChanges(IMGCHG_COMPLETE,0,1);|4:end;|0:|14:initialization|20: CoInitialize(nil);|12:finalization|17: CoUninitialize;|4:end.| link(onLoad,12449022:doEvent1,[]) link(Bitmap,8488355:Bitmap,[(321,80)(349,80)(349,137)(426,137)]) } Add(ODialog,5860046,189,35) { StartDir="\NewL\PHOTO\" Select=1 link(onExecute,10822170:doAdd,[]) } Add(ChildPanelEx,8488355,420,91) { Mode=1 link(Idx,3873157:Count,[(426,65)(291,65)(291,137)(209,137)]) } BEGIN_SDK Add(EditMultiEx,9206036,21,21) { WorkCount=#5:##add|7:##clear|9:doRefresh| VarCount=#6:Bitmap| DataCount=#3:Idx| Height=151 Point(##add) Point(##clear) link(Bitmap,16669360:Bitmap,[(272,172)]) link(##add,9654242:doEvent1,[(35,27)(35,76)]) link(doRefresh,16669360:doRefresh,[(256,41)(256,62)]) } Add(Panel,8865795,210,56) { Left=35 Top=105 Width=150 Height=150 Point(doColor) Point(doLeft) Point(doTop) Point(Width) Point(Height) } Add(PaintBox,16669360,266,56) { Width=200 Height=150 Align=5 } Add(Math,11503749,147,70) { OpType=2 ResultType=0 link(onResult,8865795:doLeft,[]) link(Op2,8865795:Width,[(160,58)(188,58)(188,100)(223,100)]) } Add(Math,13152450,98,70) { OpType=8 Op2=4 ResultType=0 link(onResult,11503749:doOperation,[]) link(Op1,13592451:Var2,[]) } Add(Math,3623704,161,119) { OpType=2 ResultType=0 link(onResult,8865795:doTop,[(201,125)(201,83)]) link(Op2,8865795:Height,[(174,109)(230,109)]) } Add(Math,717945,112,119) { OpType=7 Op2=4 ResultType=0 link(onResult,3623704:doOperation,[]) link(Op1,13592451:Var3,[(118,58)]) } Add(Hub,9654242,49,70) { link(onEvent1,13152450:doOperation,[]) link(onEvent2,717945:doOperation,[(89,83)(89,125)]) } Add(GetDataEx,13592451,91,49) { link(Data,9206036:Idx,[(104,21)]) } END_SDK Add(Hub,12449022,357,91) { OutCount=4 link(onEvent1,8488355:##add,[]) link(onEvent2,13555273:doDraw,[(402,104)(402,72)(298,72)(298,97)]) link(onEvent3,8488355:doRefresh,[]) link(onEvent4,8971666:doWork3,[(402,118)(402,143)(172,143)]) } Add(Menu,8527488,21,21) { Menu=#4:File|1:(|4:Open|5:Close|1:)| link(onSelectStr,5846604:doCase,[]) } Add(Case,5846604,70,21) { Value=String(Close) link(onNextCase,3174925:doEvent1,[]) link(onTrue,7649955:doClose,[(114,34)(114,111)]) } Add(HubEx,8971666,168,91) { link(onEvent,3873157:doNext,[]) } Add(StrList,10822170,238,35) { } Add(Hub,3174925,126,21) { OutCount=5 link(onEvent1,8488355:##clear,[(410,27)(410,104)]) link(onEvent2,10822170:doClear,[(229,34)(229,48)]) link(onEvent3,5860046:doExecute,[]) link(onEvent4,3873157:doReset,[(179,48)(179,118)]) link(onEvent5,8971666:doWork1,[(172,55)]) } Add(ArrayRW,16668781,252,98) { link(onRead,13555273:doLoad,[]) link(Array,10822170:Array,[]) } Add(Counter,3873157,203,98) { Min=-1 link(onNext,16668781:doRead,[]) }
Сколько ни пытался найти "кучу обвязки", не получилось
|