Popular Post haijie1223 Posted July 10, 2017 Popular Post Share Posted July 10, 2017 (edited) expandcollapse popup#NoTrayIcon #RequireAdmin #My QQ No: 29535065 #QQ group: 477266297 #include <GDIPlus.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Global $iSleepTime = 80 Global $hGUI = GUICreate("GDI+旋转动画", 400, 280) Global $Pic_Animation = GUICtrlCreatePic('', 5, 5, 256, 256) Global $Btn_Type1 = GUICtrlCreateButton('旋转方式一', 275, 35, 100, 30) Global $Btn_Type2 = GUICtrlCreateButton('旋转方式二', 275, 85, 100, 30) Global $Btn_Type3 = GUICtrlCreateButton('旋转方式三', 275, 135, 100, 30) Global $Slider_Time = GUICtrlCreateSlider(275, 185, 100, 45) GUICtrlSetLimit($Slider_Time, 500, 50) GUISetState() GUISetIcon('shell32.dll',322,$hGUI) GUISetOnEvent(-3, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type1, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type2, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type3, '_GuiEvent') GUICtrlSetOnEvent($Slider_Time, '_GuiEvent') _AnimationInit(ControlGetHandle($hGUI, '', $Pic_Animation), 1) _GDIPlus_Startup() ; While 1 Sleep($iSleepTime) _NextFlash() WEnd Func _GuiEvent() Switch @GUI_CtrlId Case -3 _DeleteCache() Exit Case $Btn_Type1 _ResetAniType(1, 2) Case $Btn_Type2 _ResetAniType(2, 0) Case $Btn_Type3 _ResetAniType(3, 0) Case $Slider_Time $iSleepTime=GUICtrlRead($Slider_Time) EndSwitch EndFunc ;==>_GuiEvent Func _AnimationInit($hHwd, $SpaceSec) Global $m_hWnd = $hHwd Global $m_nWidth, $m_nHeight Global $m_AnimationIndex = 0, $m_AnimationType = 0, $m_AnimationCount = 12 Global $m_ItemSize, $m_MarginAngle Global $m_hCacheDC, $m_hCacheBitmap, $m_hCacheOldBitmap Global $m_Rect = DllStructCreate($tagRECT) Global $m_ColorBack = _WinAPI_GetSysColor($COLOR_BTNFACE) Global $m_ColorBasic[2] = [0x808080, 0xC0C0C0] Global $m_ColorFore1 = [0x1FF4FB, 0x07F98C, 0x91A804, 0xCC9302, 0xAF5801, 0x9C426B, 0x9744A7, 0x9841E4, 0x241BEE, 0x2472F5, 0x2190F4, 0x12C2FF] Global $m_ColorFore2 = [0x34F5FF, 0x3CFDA3, 0xA5B833, 0xD8A733, 0xB67636, 0xAD6988, 0xAD68B9, 0xAC66E9, 0x514AEF, 0x4E8DF5, 0x4BA5FA, 0x3ECEFE] Global $m_AnimationArray[$m_AnimationCount] Local $i For $i = 0 To $m_AnimationCount - 1 $m_AnimationArray[$i] = _AnimationItem() DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorBasic[0], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorBasic[1], 255)) Next _Resize() _ResetAniType($m_AnimationType, $SpaceSec) EndFunc ;==>_AnimationInit Func _RGB2ARGB($RGBColor, $Alpha) Return BitOR(Binary('0x' & Hex($RGBColor, 6)), BitShift($Alpha, -24)) EndFunc ;==>_RGB2ARGB Func _Resize() _DeleteCache() Local $rc = _WinAPI_GetClientRect($m_hWnd) $m_nWidth = DllStructGetData($rc, 3) - DllStructGetData($rc, 1) $m_nHeight = DllStructGetData($rc, 4) - DllStructGetData($rc, 2) If $m_nWidth > $m_nHeight Then DllStructSetData($m_Rect, 3, ($m_nHeight - 10)) Else DllStructSetData($m_Rect, 3, ($m_nWidth - 10)) EndIf ;~ DllStructSetData($m_Rect, 3, ($m_nWidth > $m_nHeight) ? ($m_nHeight - 10) : ($m_nWidth - 10)) DllStructSetData($m_Rect, 4, DllStructGetData($m_Rect, 3)) DllStructSetData($m_Rect, 1, ($m_nWidth - DllStructGetData($m_Rect, 3)) / 2) DllStructSetData($m_Rect, 2, ($m_nHeight - DllStructGetData($m_Rect, 4)) / 2) $m_ItemSize = 20 EndFunc ;==>_Resize Func _ResetAniType($AniType, $SpaceSec = 0) Local $i $m_AnimationIndex = 0 Switch $AniType Case 0 $m_AnimationType = 0 Case 1 $m_AnimationType = 1 Case 2 $m_AnimationType = 2 For $i = 0 To $m_AnimationCount - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next Case 3 $m_AnimationType = 3 For $i = 0 To $m_AnimationCount - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next Case Else _ResetAniType(0) Return EndSwitch $m_MarginAngle = $SpaceSec If $m_MarginAngle > 10 Then $m_MarginAngle = 10 If $m_MarginAngle < 0 Then $m_MarginAngle = 0 EndFunc ;==>_ResetAniType Func _NextFlash() Local $i Switch $m_AnimationType Case 0 For $i = 0 To $m_AnimationIndex - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next $m_AnimationIndex += 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationType = 1 $m_AnimationIndex = 0 EndIf Case 1 For $i = 0 To $m_AnimationIndex - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorBasic[0], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorBasic[1], 255)) Next $m_AnimationIndex += 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationType = 0 $m_AnimationIndex = 0 EndIf Case 2 local $item=$m_AnimationArray[11] For $i = 0 To $m_AnimationCount - 2 $m_AnimationArray[$m_AnimationCount - $i - 1] = $m_AnimationArray[$m_AnimationCount - $i - 2] Next $m_AnimationArray[0] = $item Case 3 $m_AnimationIndex = $m_AnimationIndex + 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationIndex = 0 EndSwitch _Draw() EndFunc ;==>_NextFlash Func _Draw() Local $hDC = _WinAPI_GetDC($m_hWnd) If $m_hCacheDC = 0 Then $m_hCacheDC = _WinAPI_CreateCompatibleDC($hDC) $m_hCacheBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $m_nWidth, $m_nHeight) $m_hCacheOldBitmap = _WinAPI_SelectObject($m_hCacheDC, $m_hCacheBitmap) EndIf _FillSolidRect($m_hCacheDC, _CRect(0, 0, $m_nWidth, $m_nHeight), $m_ColorBack) _DrawPie($m_hCacheDC) _WinAPI_BitBlt($hDC, 0, 0, $m_nWidth, $m_nHeight, $m_hCacheDC, 0, 0, 0x00CC0020) _WinAPI_ReleaseDC($m_hWnd, $hDC) EndFunc ;==>_Draw Func _CRect($Left, $Top, $Right, $Bottom) Local $Rect = DllStructCreate($tagRECT) DllStructSetData($Rect, 1, $Left) DllStructSetData($Rect, 2, $Top) DllStructSetData($Rect, 3, $Right) DllStructSetData($Rect, 4, $Bottom) Return $Rect EndFunc ;==>_CRect Func _FillSolidRect($hDC, $lpRect, $clr) _WinAPI_SetBkColor($hDC, $clr) _ExtTextOut($hDC, 0, 0, 2, $lpRect, Chr(0), 0, 0) EndFunc ;==>_FillSolidRect Func _DrawPie($hDC) Local $i Local $nStartAngle Local $nSweepAngle Local $pGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC) _GDIPlus_GraphicsSetSmoothingMode($pGraphics, 4) Local $pBrush = _GDIPlus_BrushCreateSolid(_RGB2ARGB(0, 255)) Local $rcOut = DllStructCreate($tagRECT) DllStructSetData($rcOut, 1, DllStructGetData($m_Rect, 1)) DllStructSetData($rcOut, 2, DllStructGetData($m_Rect, 2)) DllStructSetData($rcOut, 3, DllStructGetData($m_Rect, 3)) DllStructSetData($rcOut, 4, DllStructGetData($m_Rect, 4)) Local $rcIn = DllStructCreate($tagRECT) DllStructSetData($rcIn, 1, DllStructGetData($rcOut, 1)) DllStructSetData($rcIn, 2, DllStructGetData($rcOut, 2)) DllStructSetData($rcIn, 3, DllStructGetData($rcOut, 3)) DllStructSetData($rcIn, 4, DllStructGetData($rcOut, 4)) _InflateRectF($rcIn, -1 * $m_ItemSize) $nSweepAngle = 360 / $m_AnimationCount $nStartAngle = -90 For $i = 0 To $m_AnimationCount - 1 _GDIPlus_BrushSetSolidColor($pBrush, DllStructGetData($m_AnimationArray[$i], 1)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcOut, 1), DllStructGetData($rcOut, 2), DllStructGetData($rcOut, 3), DllStructGetData($rcOut, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) $nStartAngle += $nSweepAngle Next $nSweepAngle = 360 / $m_AnimationCount $nStartAngle = -90 For $i = 0 To $m_AnimationCount - 1 _GDIPlus_BrushSetSolidColor($pBrush, DllStructGetData($m_AnimationArray[$i], 2)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcIn, 1), DllStructGetData($rcIn, 2), DllStructGetData($rcIn, 3), DllStructGetData($rcIn, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) $nStartAngle += $nSweepAngle Next If ($m_AnimationType = 3) Then If $m_AnimationIndex > 0 Then $nStartAngle = -90 $nStartAngle = $nStartAngle + $m_AnimationIndex * $nSweepAngle _GDIPlus_BrushSetSolidColor($pBrush, _RGB2ARGB(0xFFFFFF, 150)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcOut, 1), DllStructGetData($rcOut, 2), DllStructGetData($rcOut, 3), DllStructGetData($rcOut, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) EndIf EndIf _InflateRectF($rcIn, -1 * $m_ItemSize) _GDIPlus_BrushSetSolidColor($pBrush, _RGB2ARGB($m_ColorBack, 255)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcIn, 1), DllStructGetData($rcIn, 2), DllStructGetData($rcIn, 3), DllStructGetData($rcIn, 4), 0, 360, $pBrush) _GDIPlus_BrushDispose($pBrush) _GDIPlus_GraphicsDispose($pGraphics) EndFunc ;==>_DrawPie Func _InflateRectF($rc, $dx, $dy = 0) If $dy = 0 Then $dy = $dx DllStructSetData($rc, 1, DllStructGetData($rc, 1) - $dx) DllStructSetData($rc, 2, DllStructGetData($rc, 2) - $dy) DllStructSetData($rc, 3, DllStructGetData($rc, 3) + $dx * 2) DllStructSetData($rc, 4, DllStructGetData($rc, 4) + $dy * 2) EndFunc ;==>_InflateRectF Func _DeleteCache() If $m_hCacheDC <> 0 Then _WinAPI_SelectObject($m_hCacheDC, $m_hCacheOldBitmap) _WinAPI_DeleteObject($m_hCacheBitmap) _WinAPI_DeleteDC($m_hCacheDC) _GDIPlus_Shutdown() $m_hCacheDC = 0 $m_hCacheBitmap = 0 $m_hCacheOldBitmap = 0 EndIf EndFunc ;==>_DeleteCache Func _ExtTextOut($hDC, $x, $y, $wOptions, $lpRect, $lpString, $nCount, $lpDx) If Not IsPtr($lpRect) Then $lpRect=DllStructGetPtr($lpRect) Local $Ret = DllCall('GDI32.dll', 'BOOL', 'ExtTextOutW', 'HANDLE', $hDC, 'INT', $x, 'INT', $y, 'UINT', $wOptions, 'PTR', $lpRect, 'WSTR', $lpString, 'UINT', $nCount, 'INT', $lpDx) If @error Then Return SetError(@error, 0, 0) Return $Ret[0] EndFunc ;==>_ExtTextOut Func _AnimationItem() Return DllStructCreate('INT;INT;') EndFunc ;==>_AnimationItem Edited July 10, 2017 by haijie1223 argumentum, ptrex, wakillon and 3 others 6 Link to comment Share on other sites More sharing options...
lpxx Posted July 13, 2017 Share Posted July 13, 2017 Thanks for sharing. Powerful my brother! Link to comment Share on other sites More sharing options...
spudw2k Posted July 13, 2017 Share Posted July 13, 2017 Pretty cool sir. Just a couple of observations/questions: Why #RequireAdmin? Any particular reason you set the $SpaceSec to 1 when the script starts and 2 when you press the type 1 button? Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
czyt Posted July 13, 2017 Share Posted July 13, 2017 so cool!nice Example 董小姐,你微笑的时候很美,就像安河桥下,清澈的水... Link to comment Share on other sites More sharing options...
haijie1223 Posted July 13, 2017 Author Share Posted July 13, 2017 12 hours ago, spudw2k said: Pretty cool sir. Just a couple of observations/questions: Why #RequireAdmin? Any particular reason you set the $SpaceSec to 1 when the script starts and 2 when you press the type 1 button? #RequireAdmin is not necessary,$SpaceSec =2 is Easy to observe the effect Link to comment Share on other sites More sharing options...
skywolf Posted May 7, 2018 Share Posted May 7, 2018 very good demo Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now