D4rkC10ud

Screenmate.pb - funny dancing elephant

Aug 9th, 2012
120
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. XIncludeFile "giflib.pb"
  2.  
  3. Global Dim Frames.GIF_Frame(0)
  4. Define i, count
  5. Global BaseWindowX = 10
  6. Global BaseWindowY = 10
  7. Global TempWindowX.f = 0.0
  8. Global TempWindowY.f = 0.0
  9. Global StepDeltaX.f = 0.0
  10. Global StepDeltaY.f = 0.0  
  11. Global iStepsToMove = 0
  12. Global hWnd = 0
  13. Global Hero_gif_len=?Hero_gif_end-?Hero_gif_start+1
  14.  
  15. Enumeration
  16.   #MenuToExit = 1
  17. EndEnumeration
  18.  
  19. Procedure HideFromTaskBar(hWnd.l, Flag.l)
  20.   Protected TBL.ITaskbarList
  21.  
  22.   CoInitialize_(0)
  23.   If CoCreateInstance_(?CLSID_TaskBarList, 0, 1, ?IID_ITaskBarList, @TBL) = #S_OK
  24.     TBL\HrInit()
  25.     If Flag
  26.       TBL\DeleteTab(hWnd)
  27.     Else
  28.       TBL\AddTab(hWnd)
  29.     EndIf
  30.     TBL\Release()
  31.   EndIf
  32.   CoUninitialize_()
  33.  
  34.   DataSection
  35.     CLSID_TaskBarList:
  36.     Data.l $56FDF344
  37.     Data.w $FD6D, $11D0
  38.     Data.b $95, $8A, $00, $60, $97, $C9, $A0, $90
  39.     IID_ITaskBarList:
  40.     Data.l $56FDF342
  41.     Data.w $FD6D, $11D0
  42.     Data.b $95, $8A, $00, $60, $97, $C9, $A0, $90
  43.   EndDataSection
  44. EndProcedure
  45.  
  46. Procedure MoveTo(DestX, DestY, Speed)
  47.   BaseWindowX=BaseWindowX+Int(Round(TempWindowX, 1))
  48.   BaseWindowY=BaseWindowY+Int(Round(TempWindowY, 1))
  49.   TempWindowX=0.0
  50.   TempWindowY=0.0
  51.   DeltaX = DestX - BaseWindowX
  52.   DeltaY = DestY - BaseWindowY
  53.   iStepsToMove=Int(Round(Sqr(Pow(DeltaX, 2.0)+Pow(DeltaX, 2.0)), 1))
  54.   StepDeltaX=DeltaX/iStepsToMove
  55.   StepDeltaY=DeltaY/iStepsToMove
  56.   AddWindowTimer(0, 2, 100-Speed)
  57. EndProcedure
  58.  
  59. Procedure WaitUntilMove()
  60.   Repeat
  61.     Sleep_(500)
  62.   Until (iStepsToMove=0)
  63. EndProcedure
  64.  
  65. Procedure MainThr(Param)
  66. If GIF_LoadFrames(Frames(), "", ?Hero_gif_start, Hero_gif_len)
  67.   count = ArraySize(Frames())
  68.   OpenWindow(0, BaseWindowX, BaseWindowY, ImageWidth(Frames(0)\Image) + 20, ImageHeight(Frames(0)\Image) + 20, "", #WS_POPUP)
  69.   hWnd=WindowID(0)
  70.   HideFromTaskBar(hWnd, 1)
  71.   SetWindowColor(0, RGB($0FF, $021, $022))
  72.   SetWindowLong_(hWnd, #GWL_EXSTYLE, #WS_EX_LAYERED|#WS_EX_TOOLWINDOW|#WS_EX_TOPMOST)
  73.   SetLayeredWindowAttributes_(hWnd, GetWindowColor(0), 180, #LWA_COLORKEY)
  74.   ShowWindow_(hWnd, #SW_SHOW)
  75.  
  76.   SmartWindowRefresh(0, 1)
  77.   ImageGadget(0, 10, 10, ImageWidth(Frames(0)\Image), ImageHeight(Frames(0)\Image), ImageID(Frames(0)\Image))
  78.   If CreatePopupMenu(0)      ; creation of the pop-up menu begins...
  79.     MenuItem(#MenuToExit, "Exit")      ; You can use all commands for creating a menu
  80.   EndIf
  81.   AddWindowTimer(0, 1, Frames(0)\DelayTime * 10)
  82.   i = 0
  83.   Repeat
  84.     Select WaitWindowEvent()
  85.       Case #PB_Event_CloseWindow
  86.         Break
  87.       Case #PB_Event_Timer
  88.         Select EventTimer()
  89.           Case 1
  90.             SetGadgetState(0, ImageID(Frames(i)\Image))
  91.             ResizeWindow(0, BaseWindowX+Int(Round(TempWindowX, 1)), BaseWindowY+Int(Round(TempWindowY, 1)), #PB_Ignore, #PB_Ignore)
  92.             i + 1
  93.             If i > count : i = 0 : EndIf
  94.           Case 2
  95.             If iStepsToMove>0
  96.               TempWindowX=TempWindowX+StepDeltaX
  97.               TempWindowY=TempWindowY+StepDeltaY
  98.               iStepsToMove=iStepsToMove-1
  99.             Else
  100.               BaseWindowX=BaseWindowX+Int(Round(TempWindowX, 1))
  101.               BaseWindowY=BaseWindowY+Int(Round(TempWindowY, 1))
  102.               TempWindowX = 0
  103.               TempWindowY = 0
  104.               RemoveWindowTimer(0, 2)
  105.             EndIf
  106.         EndSelect
  107.       Case #PB_Event_Gadget
  108.         DisplayPopupMenu(0, hWnd)
  109.       Case #PB_Event_Menu
  110.           Select EventMenu()     ; get the clicked menu item...
  111.             Case #MenuToExit
  112.               End
  113.           EndSelect
  114.  
  115.     EndSelect
  116.   ForEver
  117. EndIf
  118. EndProcedure
  119. ExamineDesktops()
  120. iScrHeight=DesktopHeight(0)
  121. iScrWidth=DesktopWidth(0)
  122. CreateThread(@MainThr(), 0)
  123. Sleep_(500)
  124. While 1
  125. BaseWindowX = 10
  126. BaseWindowY = 10
  127. Sleep_(5000)
  128. MoveTo(iScrWidth-100 , iScrHeight-150, 95)
  129. WaitUntilMove()
  130. Sleep_(5000)
  131. Wend
  132. DataSection
  133. Hero_gif_start:
  134. IncludeBinary "DATA\elephant-023.gif"
  135. Hero_gif_end:
  136. EndDataSection
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×