Вверх ↑
Разработчик
Ответов: 26151
Рейтинг: 2127
#1: 2008-01-10 23:47:28 ЛС | профиль | цитата
Galkov, ну вот посмотри, почему кириллицу не читает


#sha
Add(MainForm,11367671,77,140)
{
Left=20
Top=105
Width=459
Height=281
Ctl3D=0
Caption="Reader -- BMP, GIF, JPEG, ICO, WMF, EMF, PNG, XBM, ICO, TIFF"
BorderStyle=4
Position=1
}
Add(Button,12242450,77,105)
{
Left=195
Top=225
Width=70
Height=25
TabOrder=-1
Caption="Load Files"
link(onClick,13268199:doEvent1,[])
}
Add(StrList,5123957,238,126)
{
}
Add(Image,9768314,581,133)
{
@Hint=#1:1|
Left=10
Top=10
Width=140
Height=100
Color=16777215
TabOrder=-1
ViewStyle=0
}
Add(InlineCode,5016436,399,196)
{
WorkPoints=#6:doLoad|
EventPoints=#6:onLoad|
DataPoints=#5:Width|6:Height|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|47:uses Share,Debug,Windows,ActiveX,KOLComObj,KOL;|0:|5:const|0:|29: IMGCHG_SIZE = $0001;|29: IMGCHG_VIEW = $0002;|29: IMGCHG_COMPLETE = $0004;|29: IMGCHG_ANIMATE = $0008;|29: IMGCHG_MASK = $000F;|0:|33: IMGLOAD_NOTLOADED = $00100000;|33: IMGLOAD_LOADING = $00200000;|33: IMGLOAD_STOPPED = $00400000;|33: IMGLOAD_ERROR = $00800000;|33: IMGLOAD_COMPLETE = $01000000;|33: IMGLOAD_MASK = $01F00000;|0:|33: IMGBITS_NONE = $02000000;|33: IMGBITS_PARTIAL = $04000000;|33: IMGBITS_TOTAL = $08000000;|33: IMGBITS_MASK = $0E000000;|0:|33: IMGANIM_ANIMATED = $10000000;|33: IMGANIM_MASK = $10000000;|0:|33: IMGTRANS_OPAQUE = $20000000;|33: IMGTRANS_MASK = $20000000;|0:|33: DWN_COLORMODE = $0000003F;|33: DWN_DOWNLOADONLY = $00000040;|33: DWN_FORCEDITHER = $00000080;|33: DWN_RAWIMAGE = $00000100;|0:|4:type|0:|30: IImgCtx = interface(IUnknown)|46: ['{3050f3d7-98b5-11cf-bb82-00aa00bdce0b}']|38: // Initialization/Download methods|66: function Load(pszUrl:PWChar; dwFlags:DWORD): HResult; stdcall;|91: function SelectChanges(ulChgOn:DWORD; ulChgOff:DWORD; fSignal:DWORD): HResult; stdcall;|81: function SetCallback(pCallback:pointer; pUserData:pointer): HResult; stdcall;|42: function Disconnect: HResult; stdcall;|0:|17: // Query methods|93: function GetUpdateRects(prc:PRect; var prcImg:TRect; var pcrc:integer): HResult; stdcall;|102: function GetStateInfo(var pulState:DWORD; var pSize:TSize; fClearChanges:DWORD): HResult; stdcall;|62: function GetPalette(var phpal:HPalette): HResult; stdcall;|0:|24: // Rendering methods|67: function Draw(_hdc:HDC; var prcBounds:TRect): HResult; stdcall;|105: function Tile(_hdc:HDC; var pptBackOrg:TPoint; var prcClip:TRect; var psize:TSize): HResult; stdcall;|118: 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|19: wsz : integer;|19: hsz : integer;|9: public|23: FImgCtx : IImgCtx;|23: hOK : THandle;|25: Width : THI_Event;|26: Height : THI_Event; |25: onLoad : THI_Event;|46: procedure doLoad(var dt:TData; idx:word);|5: end;|0:|14:implementation|0:|5:const|64: CLSID_IImgCtx:TGUID = '{3050f3d6-98b5-11cf-bb82-00aa00bdce0b}';|64: IID_IImgCtx:TGUID = '{3050f3d7-98b5-11cf-bb82-00aa00bdce0b}';|0:|79://function StringToWideString(const s: AnsiString; codePage: Word): WideString;|73:function StringToWideString(const s: String; codePage: Word): WideString;|17:var l: integer;|5:begin|17: if s = '' then|18: Result := ''|13: else begin|83: l := MultiByteToWideChar(codePage, MB_PRECOMPOSED, PChar(@s[1]), -1, nil, 0);|31: SetLength(Result, l - 1);|19: if l > 1 then|103: MultiByteToWideChar(CodePage, MB_PRECOMPOSED, PChar(@s[1]), -1, PWideChar(@Result[1]), l - 1);|7: end;|27:end; { StringToWideString }|0:|0:|63:procedure MyCallback(pCtx:pointer; pUserData:pointer); stdcall;|56:var pCls:THiAsmClass; stat:DWORD; sz:TSize; bmp:PBitmap;|5:begin|33: pCls := THiAsmClass(pUserData);|41: pCls.FImgCtx.GetStateInfo(stat, sz, 0);|71: if (sz.cx * 100) div sz.cy > (pCls.wsz * 100) div pCls.hsz then begin|74: bmp := NewDIBBitmap(pCls.wsz, (pCls.wsz * sz.cy) div sz.cx, pf32bit);|31: bmp.PixelFormat:= pf32bit;|123: pCls.FImgCtx.StretchBlt(bmp.Canvas.Handle, 0, 0, pCls.wsz, (pCls.wsz * sz.cy) div sz.cx, 0, 0, sz.cx, sz.cy, SRCCOPY);|5: end|12: else begin|74: bmp := NewDIBBitmap((pCls.hsz * sz.cx) div sz.cy, pCls.hsz, pf32bit);|31: bmp.PixelFormat:= pf32bit;|123: pCls.FImgCtx.StretchBlt(bmp.Canvas.Handle, 0, 0, (pCls.hsz * sz.cx) div sz.cy, pCls.hsz, 0, 0, sz.cx, sz.cy, SRCCOPY);|6: end;|32: _hi_OnEvent(pCls.onLoad, bmp);|11: bmp.Free;|21: SetEvent(pCls.hOK);|4:end;|0:|29:procedure THiAsmClass.doLoad;|29:var wName:WideString; m:TMsg;|5:begin|42: hOK := CreateEvent(nil,false,false,nil);|31: wsz := ToIntegerEvent(Width);|34: hsz := ToIntegerEvent(Height); |40: if (wsz = 0) or (hsz = 0 ) then exit; |26:// wName := ToString(dt);|46: wName := StringToWideString(ToString(dt),3);|20:// _debug(wName); |37: if not FileExists(wName) then exit;|55: FImgCtx := CreateComObject(CLSID_IImgCtx) as IImgCtx;|33: FImgCtx.Load(PWChar(wName), 0);|50: FImgCtx.SetCallback(@MyCallback, pointer(Self));|45: FImgCtx.SelectChanges(IMGCHG_COMPLETE,0,1);|58: while WaitForSingleObject(hOK,0)<>WAIT_OBJECT_0 do begin|42: if not GetMessage(m,0,0,0) then break;|24: TranslateMessage(m);|23: DispatchMessage(m);|6: end;|19: CloseHandle(hOK);|4:end;|0:|14:initialization|20: CoInitialize(nil);|12:finalization|17: CoUninitialize;|0:|4:end.|
link(onLoad,3271382:doEvent,[])
link(Width,3405297:Value,[])
link(Height,15034556:Value,[])
}
Add(Memory,3405297,399,112)
{
Default=Integer(140)
}
Add(Memory,15034556,406,133)
{
Default=Integer(100)
}
Add(Image,10722084,581,217)
{
@Hint=#1:3|
Left=300
Top=10
Width=140
Height=100
Color=16777215
TabOrder=-1
ViewStyle=0
}
Add(ArrayEnum,3757719,252,189)
{
link(onItem,14385134:doEvent1,[])
link(Array,5123957:Array,[])
}
Add(Image,5295338,581,175)
{
@Hint=#1:2|
Left=155
Top=10
Width=140
Height=100
Color=16777215
TabOrder=-1
ViewStyle=0
}
Add(Image,14742910,581,343)
{
@Hint=#1:6|
Left=300
Top=115
Width=140
Height=100
Color=16777215
TabOrder=-1
ViewStyle=0
}
Add(Image,8735878,581,301)
{
@Hint=#1:5|
Left=155
Top=115
Width=140
Height=100
Color=16777215
TabOrder=-1
ViewStyle=0
}
Add(Image,4148320,581,259)
{
@Hint=#1:4|
Left=10
Top=115
Width=140
Height=100
Color=16777215
TabOrder=-1
ViewStyle=0
}
Add(IndexToChanel,3271382,469,196)
{
Count=6
Point(Index)
link(onEvent1,9768314:doLoad,[(541,202)(541,139)])
link(onEvent2,5295338:doLoad,[(541,209)(541,181)])
link(onEvent3,10722084:doLoad,[(541,216)(541,223)])
link(onEvent4,4148320:doLoad,[(541,223)(541,265)])
link(onEvent5,8735878:doLoad,[(541,230)(541,307)])
link(onEvent6,14742910:doLoad,[(541,237)(541,349)])
link(Index,9232864:Count,[])
}
Add(Hub,13268199,126,105)
{
OutCount=5
link(onEvent1,11978606:In,[])
link(onEvent2,9232864:doReset,[(448,118)(448,160)])
link(onEvent3,5123957:doClear,[(225,125)(225,139)])
link(onEvent4,6607378:doExecute,[])
link(onEvent5,3757719:doEnum,[(177,139)(177,195)])
}
Add(ODialog,6607378,182,126)
{
Filter="PNG, JPG files (*.png;*.jpg)|*.png;*.jpg|All files (*.*)|*.*"
StartDir=""
FileName=""
Select=1
link(onExecute,5123957:doAdd,[])
}
Add(Counter,9232864,469,140)
{
Min=-1
Max=6
Default=-1
}
Add(Hub,14385134,301,189)
{
link(onEvent1,9232864:doNext,[(401,195)(401,146)])
link(onEvent2,5016436:doLoad,[])
}
Add(Hub,5281720,469,252)
{
OutCount=6
link(onEvent1,9768314:doClear,[(541,258)(541,146)])
link(onEvent2,5295338:doClear,[(541,265)(541,188)])
link(onEvent3,10722084:doClear,[(541,272)(541,230)])
link(onEvent4,4148320:doClear,[(541,279)(541,272)])
link(onEvent5,8735878:doClear,[(541,286)(541,314)])
link(onEvent6,14742910:doClear,[(541,293)(541,356)])
}
Add(LineBreak,8067229,392,252)
{
Caption="Clear"
link(Out,5281720:doEvent1,[])
Primary=[11978606,-154,-147]
}


------------ Дoбавленo:


Ты уж меня прости за размышления вслух, да и забей на то, что я написал
карма: 22

0