Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- XIncludeFile "giflib.pb"
- Global Dim Frames.GIF_Frame(0)
- Define i, count
- Global BaseWindowX = 10
- Global BaseWindowY = 10
- Global TempWindowX.f = 0.0
- Global TempWindowY.f = 0.0
- Global StepDeltaX.f = 0.0
- Global StepDeltaY.f = 0.0
- Global iStepsToMove = 0
- Global hWnd = 0
- Global Hero_gif_len=?Hero_gif_end-?Hero_gif_start+1
- Enumeration
- #MenuToExit = 1
- EndEnumeration
- Procedure HideFromTaskBar(hWnd.l, Flag.l)
- Protected TBL.ITaskbarList
- CoInitialize_(0)
- If CoCreateInstance_(?CLSID_TaskBarList, 0, 1, ?IID_ITaskBarList, @TBL) = #S_OK
- TBL\HrInit()
- If Flag
- TBL\DeleteTab(hWnd)
- Else
- TBL\AddTab(hWnd)
- EndIf
- TBL\Release()
- EndIf
- CoUninitialize_()
- DataSection
- CLSID_TaskBarList:
- Data.l $56FDF344
- Data.w $FD6D, $11D0
- Data.b $95, $8A, $00, $60, $97, $C9, $A0, $90
- IID_ITaskBarList:
- Data.l $56FDF342
- Data.w $FD6D, $11D0
- Data.b $95, $8A, $00, $60, $97, $C9, $A0, $90
- EndDataSection
- EndProcedure
- Procedure MoveTo(DestX, DestY, Speed)
- BaseWindowX=BaseWindowX+Int(Round(TempWindowX, 1))
- BaseWindowY=BaseWindowY+Int(Round(TempWindowY, 1))
- TempWindowX=0.0
- TempWindowY=0.0
- DeltaX = DestX - BaseWindowX
- DeltaY = DestY - BaseWindowY
- iStepsToMove=Int(Round(Sqr(Pow(DeltaX, 2.0)+Pow(DeltaX, 2.0)), 1))
- StepDeltaX=DeltaX/iStepsToMove
- StepDeltaY=DeltaY/iStepsToMove
- AddWindowTimer(0, 2, 100-Speed)
- EndProcedure
- Procedure WaitUntilMove()
- Repeat
- Sleep_(500)
- Until (iStepsToMove=0)
- EndProcedure
- Procedure MainThr(Param)
- If GIF_LoadFrames(Frames(), "", ?Hero_gif_start, Hero_gif_len)
- count = ArraySize(Frames())
- OpenWindow(0, BaseWindowX, BaseWindowY, ImageWidth(Frames(0)\Image) + 20, ImageHeight(Frames(0)\Image) + 20, "", #WS_POPUP)
- hWnd=WindowID(0)
- HideFromTaskBar(hWnd, 1)
- SetWindowColor(0, RGB($0FF, $021, $022))
- SetWindowLong_(hWnd, #GWL_EXSTYLE, #WS_EX_LAYERED|#WS_EX_TOOLWINDOW|#WS_EX_TOPMOST)
- SetLayeredWindowAttributes_(hWnd, GetWindowColor(0), 180, #LWA_COLORKEY)
- ShowWindow_(hWnd, #SW_SHOW)
- SmartWindowRefresh(0, 1)
- ImageGadget(0, 10, 10, ImageWidth(Frames(0)\Image), ImageHeight(Frames(0)\Image), ImageID(Frames(0)\Image))
- If CreatePopupMenu(0) ; creation of the pop-up menu begins...
- MenuItem(#MenuToExit, "Exit") ; You can use all commands for creating a menu
- EndIf
- AddWindowTimer(0, 1, Frames(0)\DelayTime * 10)
- i = 0
- Repeat
- Select WaitWindowEvent()
- Case #PB_Event_CloseWindow
- Break
- Case #PB_Event_Timer
- Select EventTimer()
- Case 1
- SetGadgetState(0, ImageID(Frames(i)\Image))
- ResizeWindow(0, BaseWindowX+Int(Round(TempWindowX, 1)), BaseWindowY+Int(Round(TempWindowY, 1)), #PB_Ignore, #PB_Ignore)
- i + 1
- If i > count : i = 0 : EndIf
- Case 2
- If iStepsToMove>0
- TempWindowX=TempWindowX+StepDeltaX
- TempWindowY=TempWindowY+StepDeltaY
- iStepsToMove=iStepsToMove-1
- Else
- BaseWindowX=BaseWindowX+Int(Round(TempWindowX, 1))
- BaseWindowY=BaseWindowY+Int(Round(TempWindowY, 1))
- TempWindowX = 0
- TempWindowY = 0
- RemoveWindowTimer(0, 2)
- EndIf
- EndSelect
- Case #PB_Event_Gadget
- DisplayPopupMenu(0, hWnd)
- Case #PB_Event_Menu
- Select EventMenu() ; get the clicked menu item...
- Case #MenuToExit
- End
- EndSelect
- EndSelect
- ForEver
- EndIf
- EndProcedure
- ExamineDesktops()
- iScrHeight=DesktopHeight(0)
- iScrWidth=DesktopWidth(0)
- CreateThread(@MainThr(), 0)
- Sleep_(500)
- While 1
- BaseWindowX = 10
- BaseWindowY = 10
- Sleep_(5000)
- MoveTo(iScrWidth-100 , iScrHeight-150, 95)
- WaitUntilMove()
- Sleep_(5000)
- Wend
- DataSection
- Hero_gif_start:
- IncludeBinary "DATA\elephant-023.gif"
- Hero_gif_end:
- EndDataSection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement