Interface IShellImageDatasFactory Extends IUnknown
CreateIShellImageDatas(a.l)
CreateImageFromFile(a.p - unicode, b.l)
CreateImageFromStream(a.l, b.l)
GetDatasFormatFromPath(a.l, b.l)
EndInterface
Interface IShellImageDatas Extends IUnknown
Decode(a.l, b.l, c.l)
Draw(a.l, b.l, c.l)
NextFrame()
NextPage()
PrevPage()
IsTransparent()
IsAnimated()
IsVector()
IsMultipage()
IsEditable()
IsPrintable()
IsDecoded()
GetCurrentPage(a.l)
GetPageCount(a.l)
SelectPage(a.l)
GetSize(a.l)
GetRawDatasFormat(a.l)
GetPixelFormat(a.l)
GetDelay(a.l)
GetProperties(a.l, b.l)
Rotate(a.l)
Scale(a.l, b.l, c.l)
DiscardEdit()
SetEncoderParams(a.l)
DisplayName(a.l, b.l)
GetResolution(a.l, b.l)
GetEncoderParams(a.l, b.l)
RegisterAbort(a.l, b.l)
CloneFrame(a.l)
ReplaceFrame(a.l)
EndInterface
#CLSCTX_INPROC_SERVER = 1
#SHIMGDEC_DEFAULT = 0
If OpenWindow(0, 0, 0, 700, 500, "Press ESC to quit", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_TitleBar)
AddWindowTimer(0, 1, 1)
ButtonGadget(0,20,20,20,20,"")
ButtonGadget(1,0,0,200,20,"открыть")
EndIf
CoInitialize_(0)
wszPath.s = OpenFileRequester("Please select", "", "GIF files (*.gif)|*.gif", 1) ;Space(#MAX_PATH)
If CoCreateInstance_(?CLSID_ShellImageDatasFactory, #Null, #CLSCTX_INPROC_SERVER, ?IID_IShellImageDatasFactory, @*factory.IShellImageDatasFactory) = 0
*Datas.IShellImageDatas
If *factory\CreateImageFromFile(wszPath, @*Datas) = 0
*Datas\Decode(#SHIMGDEC_DEFAULT, 0, 0);
rc.RECT
rc\left = 0;
rc\top = 0;
*Datas\GetSize(@rc\right);
dc.l = GetDC_(GadgetID(0));
*Datas\Draw(dc, @rc, @rc);
ResizeGadget(0,#PB_Ignore,#PB_Ignore,rc\right+2,rc\bottom+2)
If *Datas\IsAnimated() = 0
While GetAsyncKeyState_(#VK_ESCAPE) = 0
Event = WaitWindowEvent()
gEvent = EventGadget()
If Event = #PB_Event_CloseWindow
Break
EndIf
If Event = #PB_Event_Gadget
Select gEvent
Case 1
wszPath.s = OpenFileRequester("Please select", "", "GIF files (*.gif)|*.gif", 1)
*factory\CreateImageFromFile(wszPath, @*Datas)
*Datas\Decode(#SHIMGDEC_DEFAULT, 0, 0);
rc.RECT
rc\left = 0;
rc\top = 0;
*Datas\GetSize(@rc\right);
dc.l = GetDC_(GadgetID(0));
*Datas\Draw(dc, @rc, @rc);
ResizeGadget(0,#PB_Ignore,#PB_Ignore,rc\right+2,rc\bottom+2)
EndSelect
EndIf
*Datas\GetDelay(@time);
; Sleep_(time);
If Event = #PB_Event_Timer And EventTimer() = 1
If t>time
t=0
InvalidateRect_(GadgetID(0),@rc, #True)
If *Datas\NextFrame()
*Datas\SelectPage(0);
EndIf
Else
t=t+20
EndIf
Else
*Datas\Draw(dc, @rc, @rc);
EndIf
Wend
EndIf
ReleaseDC_(0, dc);
;/ / remove image from desktop
rc\bottom = rc\bottom + 20;
InvalidateRect_(0, @rc, #True);
*Datas\Release();
EndIf
*factory\Release();
EndIf
; EndIf
CoUninitialize_();
Macro DefineGUID(IID, Data1, Data2, Data3, Data4, Data5, Data6, Data7, Data8, Data9, Data10, Data11)
DataSection
IID :
Data.l Data1
Data.w Data2, Data3
Data.b Data4, Data5, Data6, Data7, Data8, Data9, Data10, Data11
EndDataSection
EndMacro
DefineGUID(CLSID_ShellImageDatasFactory, $66e4e4fb, $f385, $4dd0, $8d, $74, $a2, $ef, $d1, $bc, $61, $78)
DefineGUID(IID_IShellImageDatasFactory, $9be8ed5c, $edab, $4d75, $90, $f3, $bd, $5b, $db, $b2, $1c, $82)