Yashied Posted January 15, 2011 Share Posted January 15, 2011 (edited) A simple example of creating a pop-up circular menu in the style of >iKey. Menu is activated by pressing and holding down the middle mouse button. Also I wrote six animated effects (commented out) for a pop-up menu. All required images and cursors is in the archive. To run this script required >WinAPIEx UDF library. expandcollapse popup#Include <APIConstants.au3> #Include <GDIPlus.au3> #Include <Misc.au3> #Include <WinAPIEx.au3> Opt('WinWaitDelay', 0) _GDIPlus_Startup() $hHand = _WinAPI_LoadCursorFromFile(@ScriptDir & '\Arrow.cur') $hPrev = _WinAPI_CopyCursor(_WinAPI_LoadCursor(0, 32512)) Dim $hImage[9][2] For $i = 0 To 8 $hImage[$i][0] = _GDIPlus_ImageLoadFromFile(StringFormat(@ScriptDir & '\%02d.png', $i)) $hImage[$i][1] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage[$i][0]) Next $hForm = GUICreate('', 190, 190, -1, -1, $WS_POPUPWINDOW, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST), GUICreate('', -1, -1, -1, -1, -1, $WS_EX_TOOLWINDOW)) Dim $Tip[2] While 1 Sleep(100) If _IsPressed('04') Then $XY = MouseGetPos() GUISetState(@SW_SHOWNOACTIVATE, $hForm) ; Animation 1 WinMove($hForm, '', $XY[0] - 95, $XY[1] - 95, 190, 190) $hPng = _GDIPlus_ImageClone($hImage[0][0]) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hPng) For $i = 5 To 255 Step 5 $Size = Round(190 * $i / 255) If Mod($Size, 2) Then $Size += 1 EndIf _GDIPlus_GraphicsClear($hGraphic, 0) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage[0][0], (190 - $Size) / 2, (190 - $Size) / 2, $Size, $Size) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, _GDIPlus_BitmapCreateHBITMAPFromBitmap($hPng), $i, 1) ; _Sleep(1) Next _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1]) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hPng) ; Animation 2 #cs WinMove($hForm, '', $XY[0] - 190, $XY[1] - 190, 380, 380) $hPng = _GDIPlus_ImageGetThumbnail($hImage[0][0], 380, 380) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hPng) For $i = 5 To 255 Step 5 $Size = Round(190 * (2 - $i / 255)) If Mod($Size, 2) Then $Size += 1 EndIf _GDIPlus_GraphicsClear($hGraphic, 0) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage[0][0], (380 - $Size) / 2, (380 - $Size) / 2, $Size, $Size) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, _GDIPlus_BitmapCreateHBITMAPFromBitmap($hPng), $i, 1) ; _Sleep(1) Next _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1], 0) WinMove($hForm, '', $XY[0] - 95, $XY[1] - 95, 190, 190) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1]) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hPng) #ce ; Animation 3 #cs WinMove($hForm, '', $XY[0] - 95, $XY[1] - 95, 190, 190) $hMatrix = _GDIPlus_MatrixCreate() $hPng = _GDIPlus_ImageClone($hImage[0][0]) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hPng) _GDIPlus_MatrixTranslate($hMatrix, 95, 95) For $i = 5 To 255 Step 5 If $i = 5 Then _GDIPlus_MatrixRotate($hMatrix, -75) Else _GDIPlus_MatrixRotate($hMatrix, 1.5) EndIf _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix) _GDIPlus_GraphicsClear($hGraphic, 0) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage[0][0], -95, -95, 190, 190) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, _GDIPlus_BitmapCreateHBITMAPFromBitmap($hPng), $i, 1) ; _Sleep(1) Next _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1]) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_ImageDispose($hPng) #ce ; Animation 4 #cs WinMove($hForm, '', $XY[0] - 95, $XY[1] - 95, 190, 190) For $i = 5 To 255 Step 5 _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1], $i) _Sleep(1) Next #ce ; Animation 5 #cs WinMove($hForm, '', $XY[0] - 95, $XY[1] - 95, 190, 190) $hMatrix = _GDIPlus_MatrixCreate() $hPng = _GDIPlus_ImageClone($hImage[0][0]) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hPng) _GDIPlus_MatrixTranslate($hMatrix, 95, 95) For $i = 5 To 255 Step 5 $Size = Round(190 * $i / 255) If Mod($Size, 2) Then $Size += 1 EndIf If $i = 5 Then _GDIPlus_MatrixRotate($hMatrix, -100) Else _GDIPlus_MatrixRotate($hMatrix, 2) EndIf _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix) _GDIPlus_GraphicsClear($hGraphic, 0) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage[0][0], (190 - $Size) / 2 - 95, (190 - $Size) / 2 - 95, $Size, $Size) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, _GDIPlus_BitmapCreateHBITMAPFromBitmap($hPng), $i, 1) _Sleep(1) Next _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1]) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_ImageDispose($hPng) #ce ; Animation 6 #cs WinMove($hForm, '', $XY[0] - 190, $XY[1] - 190, 380, 380) $hMatrix = _GDIPlus_MatrixCreate() $hPng = _GDIPlus_ImageGetThumbnail($hImage[0][0], 380, 380) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hPng) _GDIPlus_MatrixTranslate($hMatrix, 190, 190) For $i = 5 To 255 Step 5 $Size = Round(190 * (2 - $i / 255)) If Mod($Size, 2) Then $Size += 1 EndIf If $i = 5 Then _GDIPlus_MatrixRotate($hMatrix, -100) Else _GDIPlus_MatrixRotate($hMatrix, 2) EndIf _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix) _GDIPlus_GraphicsClear($hGraphic, 0) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage[0][0], (380 - $Size) / 2 - 190, (380 - $Size) / 2 - 190, $Size, $Size) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, _GDIPlus_BitmapCreateHBITMAPFromBitmap($hPng), $i, 1) _Sleep(1) Next _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1], 0) WinMove($hForm, '', $XY[0] - 95, $XY[1] - 95, 190, 190) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1]) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_ImageDispose($hPng) #ce $Timer = 0 $Tip[0] = -1 $Tip[1] = -1 $Item = 0 $Prev = 0 _WinAPI_SetSystemCursor($hHand, 32512, 1) While _IsPressed('04') $Pos = MouseGetPos() $R = Sqrt(($XY[0] - $Pos[0]) ^ 2 + ($XY[1] - $Pos[1]) ^ 2) If ($R < 47) Or ($R > 95) Then $Item = 0 Else $Ang = _Angle($Pos[0], $Pos[1], $XY[0], $XY[1]) Select Case ($Ang >= 0 ) And ($Ang < 45 ) $Item = 1 Case ($Ang >= 45 ) And ($Ang < 90 ) $Item = 2 Case ($Ang >= 90 ) And ($Ang < 135) $Item = 3 Case ($Ang >= 135) And ($Ang < 180) $Item = 4 Case ($Ang >= 180) And ($Ang < 225) $Item = 5 Case ($Ang >= 225) And ($Ang < 270) $Item = 6 Case ($Ang >= 270) And ($Ang < 315) $Item = 7 Case Else $Item = 8 EndSelect EndIf If $Prev <> $Item Then _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[$Item][1]) $Prev = $Item EndIf If ($Pos[0] = $Tip[0]) And ($Pos[1] = $Tip[1]) Then If ($Item) And ($Timer) And (TimerDiff($Timer) > 500) Then ToolTip('Action ' & $Item, $Pos[0] + 8, $Pos[1] + 22) $Timer = 0 EndIf Else $Timer = TimerInit() $Tip[0] = $Pos[0] $Tip[1] = $Pos[1] ToolTip('') EndIf WEnd _WinAPI_SetSystemCursor($hPrev, 32512, 1) ToolTip('') For $i = 250 To 0 Step -5 _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[$Item][1], $i) _Sleep(1) Next GUISetState(@SW_HIDE, $hForm) If $Item Then MsgBox(0, '', 'Action ' & $Item & '...') EndIf EndIf WEnd Func _Angle($X, $Y, $XC, $YC) If ($X = $XC) And ($Y = $YC) Then Return 0 Else Return Mod(360 + 22.5 + ($Y > $YC) * 180 - ATan(($XC - $X) / ($YC - $Y)) * 45 / ATan(1), 360) EndIf EndFunc ;==>_Angle Func _Sleep($iDelay) Local $Timer = TimerInit() While TimerDiff($Timer) < $iDelay WEnd EndFunc ;==>_Sleep #Region GDI+ Functions Func _GDIPlus_ImageClone($hImage) Local $aResult = DllCall($ghGDIPDll, 'uint', 'GdipCloneImage', 'ptr', $hImage, 'ptr*', 0) If @error Then Return SetError(@error, @extended, 0) EndIf Return $aResult[2] EndFunc ;==>_GDIPlus_ImageClone Func _GDIPlus_ImageGetThumbnail($hImage, $iWidth, $iHeight) Local $aResult = DllCall($ghGDIPDll, 'uint', 'GdipGetImageThumbnail', 'ptr', $hImage, 'int', $iWidth, 'int', $iHeight, 'ptr*', 0, 'ptr', 0, 'ptr', 0) If @error Then Return SetError(@error, @extended, 0) EndIf Return $aResult[4] EndFunc ;==>_GDIPlus_ImageGetThumbnail #EndRegion GDI+ FunctionsCircularMenu.7zPrevious downloads: 663CircularMenu.7z Edited December 22, 2013 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Yashied Posted January 15, 2011 Author Share Posted January 15, 2011 (edited) Deleted. Edited January 15, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
taietel Posted January 15, 2011 Share Posted January 15, 2011 Great job, Yashied! Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
KaFu Posted January 16, 2011 Share Posted January 16, 2011 Wow, looks awesome! Thanks for another great example ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
playlet Posted January 17, 2011 Share Posted January 17, 2011 (edited) --- Edited August 18, 2016 by playlet Link to comment Share on other sites More sharing options...
mdwerne Posted December 7, 2011 Share Posted December 7, 2011 Just came across this script and wanted to give it a try, sadly I'm getting some errors that I'm unable to resolve. >Running AU3Check (1.54.19.0) from:C:Program Files (x86)AutoIt3 C:UsersmdwerneDownloadsCircularMenuEx.au3(52,54) : ERROR: _WinAPI_UpdateLayeredWindowEx() called with wrong number of args. _WinAPI_UpdateLayeredWindowEx($hForm, $hImage[0][1]) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:UsersmdwerneDownloadsCircularMenuWinAPIEx.au3(29916,93) : REF: definition of _WinAPI_UpdateLayeredWindowEx(). Func _WinAPI_UpdateLayeredWindowEx($hWnd, $iX, $iY, $hBitmap, $iOpacity = 255, $fDelete = 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:UsersmdwerneDownloadsCircularMenuEx.au3(210,60) : ERROR: _WinAPI_UpdateLayeredWindowEx() called with wrong number of args. _WinAPI_UpdateLayeredWindowEx($hForm, $hImage[$Item][1]) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:UsersmdwerneDownloadsCircularMenuWinAPIEx.au3(29916,93) : REF: definition of _WinAPI_UpdateLayeredWindowEx(). Func _WinAPI_UpdateLayeredWindowEx($hWnd, $iX, $iY, $hBitmap, $iOpacity = 255, $fDelete = 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:UsersmdwerneDownloadsCircularMenuEx.au3(228,63) : ERROR: _WinAPI_UpdateLayeredWindowEx() called with wrong number of args. _WinAPI_UpdateLayeredWindowEx($hForm, $hImage[$Item][1], $i) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:UsersmdwerneDownloadsCircularMenuWinAPIEx.au3(29916,93) : REF: definition of _WinAPI_UpdateLayeredWindowEx(). Func _WinAPI_UpdateLayeredWindowEx($hWnd, $iX, $iY, $hBitmap, $iOpacity = 255, $fDelete = 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:UsersmdwerneDownloadsCircularMenuEx.au3 - 3 error(s), 0 warning(s) !>08:26:11 AU3Check ended.rc:2 >Exit code: 0 Time: 4.833 I assume some changes were made to WinAPIEx.au3 that are affecting this script. Any thoughts? Thanks, -Mike Link to comment Share on other sites More sharing options...
Yashied Posted December 7, 2011 Author Share Posted December 7, 2011 (edited) Replace everywhere _WinAPI_UpdateLayeredWindowEx($hForm, ...) to _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, ...) Edited December 7, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
wakillon Posted December 7, 2011 Share Posted December 7, 2011 (edited) Replace everywhere _WinAPI_UpdateLayeredWindowEx($hForm, ...) to _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, ...) Sure ? ( _WinAPI_UpdateLayeredWindowEx ( $hWnd, $hBitmap, $iX, $iY [, $iOpacity [, $fDelete]] ) ) Can't get it working... Edited December 7, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Yashied Posted December 7, 2011 Author Share Posted December 7, 2011 (edited) _WinAPI_UpdateLayeredWindowEx ( $hWnd, $hBitmap, $iX, $iY [, $iOpacity [, $fDelete]] ) Wrong description. Fixed. Edited December 7, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
ValeryVal Posted December 9, 2011 Share Posted December 9, 2011 (edited) Can't get it working.. Try start this and press middle mouse button anywhere. To select menu item you should hold and move mouse cursor. This ex1.au3 is Yashied's one which can change animation of itself from it's circular menu. Look at $Action and cases of Switch. expandcollapse popup#Include <GDIPlus.au3> #Include <Misc.au3> #Include <WinAPIEx.au3> #Include <WindowsConstants.au3> Opt('WinWaitDelay', 0) Global $Action = 1 _GDIPlus_Startup() $hHand = _WinAPI_LoadCursorFromFile(@ScriptDir & 'Arrow.cur') $hPrev = _WinAPI_CopyCursor(_WinAPI_LoadCursor(0, 32512)) Dim $hImage[9][2] For $i = 0 To 8 $hImage[$i][0] = _GDIPlus_ImageLoadFromFile(StringFormat(@ScriptDir & '%02d.png', $i)) $hImage[$i][1] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage[$i][0]) Next $hForm = GUICreate('', 190, 190, -1, -1, $WS_POPUPWINDOW, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST), GUICreate('', -1, -1, -1, -1, -1, $WS_EX_TOOLWINDOW)) Dim $Tip[2] While 1 Sleep(100) If _IsPressed('04') Then $XY = MouseGetPos() GUISetState(@SW_SHOWNOACTIVATE, $hForm) Switch $Action ; Animation 1 case 1 WinMove($hForm, '', $XY[0] - 95, $XY[1] - 95, 190, 190) $hPng = _GDIPlus_ImageClone($hImage[0][0]) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hPng) For $i = 5 To 255 Step 5 $Size = Round(190 * $i / 255) If Mod($Size, 2) Then $Size += 1 EndIf _GDIPlus_GraphicsClear($hGraphic, 0) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage[0][0], (190 - $Size) / 2, (190 - $Size) / 2, $Size, $Size) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, _GDIPlus_BitmapCreateHBITMAPFromBitmap($hPng), $i, 1) ; _Sleep(1) Next _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1]) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hPng) ; Animation 2 case 2 ;#cs WinMove($hForm, '', $XY[0] - 190, $XY[1] - 190, 380, 380) $hPng = _GDIPlus_ImageGetThumbnail($hImage[0][0], 380, 380) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hPng) For $i = 5 To 255 Step 5 $Size = Round(190 * (2 - $i / 255)) If Mod($Size, 2) Then $Size += 1 EndIf _GDIPlus_GraphicsClear($hGraphic, 0) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage[0][0], (380 - $Size) / 2, (380 - $Size) / 2, $Size, $Size) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, _GDIPlus_BitmapCreateHBITMAPFromBitmap($hPng), $i, 1) ; _Sleep(1) Next _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1], 0) WinMove($hForm, '', $XY[0] - 95, $XY[1] - 95, 190, 190) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1]) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hPng) ;#ce ; Animation 3 case 3 ;#cs WinMove($hForm, '', $XY[0] - 95, $XY[1] - 95, 190, 190) $hMatrix = _GDIPlus_MatrixCreate() $hPng = _GDIPlus_ImageClone($hImage[0][0]) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hPng) _GDIPlus_MatrixTranslate($hMatrix, 95, 95) For $i = 5 To 255 Step 5 If $i = 5 Then _GDIPlus_MatrixRotate($hMatrix, -75) Else _GDIPlus_MatrixRotate($hMatrix, 1.5) EndIf _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix) _GDIPlus_GraphicsClear($hGraphic, 0) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage[0][0], -95, -95, 190, 190) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, _GDIPlus_BitmapCreateHBITMAPFromBitmap($hPng), $i, 1) ; _Sleep(1) Next _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1]) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_ImageDispose($hPng) ;#ce ; Animation 4 case 4 ;#cs WinMove($hForm, '', $XY[0] - 95, $XY[1] - 95, 190, 190) For $i = 5 To 255 Step 5 _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1], $i) _Sleep(1) Next ;#ce ; Animation 5 case 5 ;#cs WinMove($hForm, '', $XY[0] - 95, $XY[1] - 95, 190, 190) $hMatrix = _GDIPlus_MatrixCreate() $hPng = _GDIPlus_ImageClone($hImage[0][0]) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hPng) _GDIPlus_MatrixTranslate($hMatrix, 95, 95) For $i = 5 To 255 Step 5 $Size = Round(190 * $i / 255) If Mod($Size, 2) Then $Size += 1 EndIf If $i = 5 Then _GDIPlus_MatrixRotate($hMatrix, -100) Else _GDIPlus_MatrixRotate($hMatrix, 2) EndIf _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix) _GDIPlus_GraphicsClear($hGraphic, 0) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage[0][0], (190 - $Size) / 2 - 95, (190 - $Size) / 2 - 95, $Size, $Size) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, _GDIPlus_BitmapCreateHBITMAPFromBitmap($hPng), $i, 1) _Sleep(1) Next _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1]) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_ImageDispose($hPng) ;#ce ; Animation 6 case 6 ;#cs WinMove($hForm, '', $XY[0] - 190, $XY[1] - 190, 380, 380) $hMatrix = _GDIPlus_MatrixCreate() $hPng = _GDIPlus_ImageGetThumbnail($hImage[0][0], 380, 380) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hPng) _GDIPlus_MatrixTranslate($hMatrix, 190, 190) For $i = 5 To 255 Step 5 $Size = Round(190 * (2 - $i / 255)) If Mod($Size, 2) Then $Size += 1 EndIf If $i = 5 Then _GDIPlus_MatrixRotate($hMatrix, -100) Else _GDIPlus_MatrixRotate($hMatrix, 2) EndIf _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix) _GDIPlus_GraphicsClear($hGraphic, 0) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage[0][0], (380 - $Size) / 2 - 190, (380 - $Size) / 2 - 190, $Size, $Size) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, _GDIPlus_BitmapCreateHBITMAPFromBitmap($hPng), $i, 1) _Sleep(1) Next _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1], 0) WinMove($hForm, '', $XY[0] - 95, $XY[1] - 95, 190, 190) _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1]) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_ImageDispose($hPng) ;#ce case else WinMove($hForm, '', $XY[0] - 95, $XY[1] - 95, 190, 190) For $i = 5 To 255 Step 5 _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[0][1], $i) _Sleep(1) Next endswitch $Timer = 0 $Tip[0] = -1 $Tip[1] = -1 $Item = 0 $Prev = 0 _WinAPI_SetSystemCursor($hHand, 32512, 1) While _IsPressed('04') $Pos = MouseGetPos() $R = Sqrt(($XY[0] - $Pos[0]) ^ 2 + ($XY[1] - $Pos[1]) ^ 2) If ($R < 47) Or ($R > 95) Then $Item = 0 Else $Ang = _Angle($Pos[0], $Pos[1], $XY[0], $XY[1]) Select Case ($Ang >= 0 ) And ($Ang < 45 ) $Item = 1 Case ($Ang >= 45 ) And ($Ang < 90 ) $Item = 2 Case ($Ang >= 90 ) And ($Ang < 135) $Item = 3 Case ($Ang >= 135) And ($Ang < 180) $Item = 4 Case ($Ang >= 180) And ($Ang < 225) $Item = 5 Case ($Ang >= 225) And ($Ang < 270) $Item = 6 Case ($Ang >= 270) And ($Ang < 315) $Item = 7 Case Else $Item = 8 EndSelect EndIf If $Prev <> $Item Then _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[$Item][1]) $Prev = $Item EndIf If ($Pos[0] = $Tip[0]) And ($Pos[1] = $Tip[1]) Then If ($Item) And ($Timer) And (TimerDiff($Timer) > 500) Then ToolTip('Action ' & $Item, $Pos[0] + 8, $Pos[1] + 22) $Timer = 0 EndIf Else $Timer = TimerInit() $Tip[0] = $Pos[0] $Tip[1] = $Pos[1] ToolTip('') EndIf WEnd _WinAPI_SetSystemCursor($hPrev, 32512, 1) ToolTip('') For $i = 250 To 0 Step -5 _WinAPI_UpdateLayeredWindowEx($hForm, -1, -1, $hImage[$Item][1], $i) _Sleep(1) Next GUISetState(@SW_HIDE, $hForm) If $Item Then $Action = $Item ;MsgBox(0, '', 'Action ' & $Item & '...') EndIf EndIf WEnd Func _Angle($X, $Y, $XC, $YC) If ($X = $XC) And ($Y = $YC) Then Return 0 Else Return Mod(360 + 22.5 + ($Y > $YC) * 180 - ATan(($XC - $X) / ($YC - $Y)) * 45 / ATan(1), 360) EndIf EndFunc ;==>_Angle Func _Sleep($iDelay) Local $Timer = TimerInit() While TimerDiff($Timer) < $iDelay WEnd EndFunc ;==>_Sleep #Region GDI+ Functions Func _GDIPlus_ImageClone($hImage) Local $aResult = DllCall($ghGDIPDll, 'uint', 'GdipCloneImage', 'ptr', $hImage, 'ptr*', 0) If @error Then Return SetError(@error, @extended, 0) EndIf Return $aResult[2] EndFunc ;==>_GDIPlus_ImageClone Func _GDIPlus_ImageGetThumbnail($hImage, $iWidth, $iHeight) Local $aResult = DllCall($ghGDIPDll, 'uint', 'GdipGetImageThumbnail', 'ptr', $hImage, 'int', $iWidth, 'int', $iHeight, 'ptr*', 0, 'ptr', 0, 'ptr', 0) If @error Then Return SetError(@error, @extended, 0) EndIf Return $aResult[4] EndFunc ;==>_GDIPlus_ImageGetThumbnail #EndRegion GDI+ Functions Edited December 9, 2011 by ValeryVal The point of world view Link to comment Share on other sites More sharing options...
wakillon Posted December 9, 2011 Share Posted December 9, 2011 (edited) Wrong description. Fixed. You are right, but i have extract this Syntax of the description of _WinAPI_UpdateLayeredWindowEx Function in WinApiEx.au3 3.5 ; Syntax.........: _WinAPI_UpdateLayeredWindowEx ( $hWnd, $hBitmap, $iX, $iY [, $iOpacity [, $fDelete]] ) ... Func _WinAPI_UpdateLayeredWindowEx($hWnd, $iX, $iY, $hBitmap, $iOpacity = 255, $fDelete = 0) Nice Work ! @ValeryVal Thanks. In the doubt i have tried on another PC and it works well with Yashield modifs. My middle mouse button was in cause... Edited December 9, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
E1M1 Posted December 11, 2011 Share Posted December 11, 2011 for some reason I get C:UsersraintabbedEx.au3(44,55) : ERROR: _WinAPI_UpdateLayeredWindowEx() called with wrong number of args. _WinAPI_UpdateLayeredWindowEx($hForm, $hImage[0][1]) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:UsersraintabbedWinAPIEx.au3(29916,93) : REF: definition of _WinAPI_UpdateLayeredWindowEx(). Func _WinAPI_UpdateLayeredWindowEx($hWnd, $iX, $iY, $hBitmap, $iOpacity = 255, $fDelete = 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:UsersraintabbedEx.au3(202,60) : ERROR: _WinAPI_UpdateLayeredWindowEx() called with wrong number of args. _WinAPI_UpdateLayeredWindowEx($hForm, $hImage[$Item][1]) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:UsersraintabbedWinAPIEx.au3(29916,93) : REF: definition of _WinAPI_UpdateLayeredWindowEx(). Func _WinAPI_UpdateLayeredWindowEx($hWnd, $iX, $iY, $hBitmap, $iOpacity = 255, $fDelete = 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:UsersraintabbedEx.au3(220,63) : ERROR: _WinAPI_UpdateLayeredWindowEx() called with wrong number of args. _WinAPI_UpdateLayeredWindowEx($hForm, $hImage[$Item][1], $i) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:UsersraintabbedWinAPIEx.au3(29916,93) : REF: definition of _WinAPI_UpdateLayeredWindowEx(). Func _WinAPI_UpdateLayeredWindowEx($hWnd, $iX, $iY, $hBitmap, $iOpacity = 255, $fDelete = 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:UsersraintabbedEx.au3 - 3 error(s), 0 warning(s) edited Link to comment Share on other sites More sharing options...
wakillon Posted December 11, 2011 Share Posted December 11, 2011 @E1M1 Read post #7 AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
mdwerne Posted December 13, 2011 Share Posted December 13, 2011 Thanks Yashied and ValeryVal for the updates...works great now! Link to comment Share on other sites More sharing options...
willichan Posted December 13, 2011 Share Posted December 13, 2011 I love it! Putting together my new launcher now. My UDFs: Barcode Libraries, Automate creation of any type of project folder, File Locking with Cooperative Semaphores, Inline binary files, Continue script after reboot, WinWaitMulti, Name Aggregator, Enigma, CornedBeef Hash 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