Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/15/2018 in all areas

  1. Version 0.2024.9.16

    5,400 downloads

    This is @Yashied's most excellent control viewer, modified by me, based on the code @boomingranny posted. There are 2 forum entries, one shows active and the other depreciated, and not seen @Yashied since March 2016, so I feel is OK to post this, tho, i'd take it down upon request. PS: Do run as Admin if available, as it may not do what you need without the rights.
    1 point
  2. Beege

    Tray Icon Bar Graph UDF

    Here is the latest UDF that I have been working on. Its sort of a spin off from my other Graph UDF. Its for creating a scrolling bar graph as the tray icon. Its very similar to how the program ProcessExploror by sysinternals displays cpu history. Please let me know what you think, especially if you have any kind of problems. Thanks for looking. Example #include "TIG.au3" Opt('GuiOnEventMode', 1); Black Green Pink Yellow Blue Red Purple Orange Gray Local $Color, $Invert, $aColors[9] = [0xFF000000, 0xFF00FF00, 0xFFF004DE, 0xFFFFFF00, 0xFF00ACFF, 0xFFFF0000, 0xFF8000FF, 0xFFFF8000, 0xFFADADAD] Local $GUI = GUICreate('TrayIcon', 200, 50) GUISetOnEvent(-3, '_Exit', $GUI) GUISetState() _TIG_CreateTrayGraph(0, 1000) While 1 $Color = $aColors[Random(0,8,1)] $Invert = _Invert($Color) _TIG_SetBackGoundColor($Color) _TIG_SetBarColor($Invert) For $i = 0 To 16 _TIG_UpdateTrayGraph(Random(0, 1000, 1)) Sleep(100) Next WEnd Func _Exit() Exit EndFunc ;==>_Exit ;Returns Invert of ARGB value Func _Invert($iValue) Return '0x' & Hex(BitOR(0xFF000000,(0xFFFFFFFF-$iValue)),8) EndFunc UDF #Region Header ; #INDEX# ======================================================================================================================= ; Title .........: TIG ; AutoIt Version : 3.3.4.0 ; Language ......: English ; Description ...: Functions to create and update a tray icon scrolling bar graph ; Author(s) .....: Beege ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_TIG_CreateTrayGraph ;_TIG_SetBarColor ;_TIG_SetBackGoundColor ;_TIG_SetRange ;_TIG_UpdateTrayGraph ; =============================================================================================================================== #cs CallTips: _TIG_CreateTrayGraph($iMin = 0, $iMax = 100, $iBarColor = 0xFF00ACFF, $iBackColor = 0xFF000000) Default $iBarColor = Blue; $iBackColor = Black _TIG_SetBarColor($iBarColor = 0xFF00ACFF) Default $iBarColor = Blue _TIG_SetBackGoundColor($iBackColor = 0xFF000000) Default $iBackColor = Black _TIG_SetRange($iMin = 0, $iMax = 100) _TIG_UpdateTrayGraph($iValue) #ce #include <GDIPlus.au3> #include <WindowsConstants.au3> #EndRegion Header #Region Initialization AutoItWinSetTitle(AutoItWinGetTitle() & '_TraYIcoNUdF') #EndRegion Initialization #Region Global Variables and Constants Global Enum $g_hGUI, $g_hGraphics, $g_hBitmap, $g_hBuffer, $g_hPen, $g_iMin, $g_iMax, $g_iBackColor, $g_iBarColor, $g_hIcon, $g_sValues, $g_hShell32, $iMax Global $aTI[$iMax] $aTI[$g_hGUI] = WinGetHandle(AutoItWinGetTitle()) #cs $aTI[$g_hGUI] = Autoit Window Handle $aTI[$g_hGraphics] = Handle to Graphics object $aTI[$g_hBitmap] = Handle to Bitmap Object $aTI[$g_hBuffer] = Handle to Buffer $aTI[$g_hPen] = Handle to Pen Object $aTI[$g_iMin] = Minimum Y Range $aTI[$g_iMax] = Maximum Y Range $aTI[$g_iBackColor] = Background Color $aTI[$g_iBarColor] = Bar Color $aTI[$g_hIcon] = Handle to Icon Bitmap $aTI[$g_sValues] = String Containing Y Value History $aTI[$g_hShell32] = Handle to Shell32 dll #ce #EndRegion Global Variables and Constants #Region Public Functions ; #FUNCTION# ==================================================================================================================== ; Name...........: _TIG_CreateTrayGraph ; Description ...: Creates Tray Icon Bar Graph ; Syntax.........: _TIG_CreateTrayGraph($iMin = 0, $iMax = 100, $iBarColor = 0xFF00ACFF, $iBackColor = 0xFF000000) ; Parameters ....: $iMin - Minimum Y Value. Must Not be less than 0. ; $iMax - Maximum Y Value ; $iBarColor - Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB). Default = Blue ; $iBackColor - Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB). Default = Black ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 Minimum Value Less than zero ; - <> 0 - Value returned from _WinAPI_GetLastERROR() ; Author ........: Beege ; Remarks .......: ; =============================================================================================================================== Func _TIG_CreateTrayGraph($iMin = 0, $iMax = 100, $iBarColor = 0xFF00ACFF, $iBackColor = 0xFF000000) If $iMin < 0 Then Return SetError(1, @extended, 0) _GDIPlus_Startup() OnAutoItExitRegister('_GdiExit') If $iBarColor = -1 Or $iBarColor = Default Then $iBarColor = 0xFF00ACFF If $iBackColor = -1 Or $iBackColor = Default Then $iBackColor = 0xFF000000 If $iMin = -1 Or $iMin = Default Then $iMin = 0 If $iMax = -1 Or $iMax = Default Then $iMax = 100 $aTI[$g_hGraphics] = _GDIPlus_GraphicsCreateFromHWND($aTI[$g_hGUI]) $aTI[$g_hBitmap] = _GDIPlus_BitmapCreateFromGraphics(16, 16, $aTI[$g_hGraphics]) $aTI[$g_hBuffer] = _GDIPlus_ImageGetGraphicsContext($aTI[$g_hBitmap]) $aTI[$g_hPen] = _GDIPlus_PenCreate($iBarColor, 1) $aTI[$g_hIcon] = -1 $aTI[$g_sValues] = 0 $aTI[$g_iBackColor] = $iBackColor $aTI[$g_iMin] = $iMin $aTI[$g_iMax] = $iMax $aTI[$g_hShell32] = DllOpen('shell32.dll') _GDIPlus_GraphicsClear($aTI[$g_hBuffer], $iBackColor) _GDIPlus_GraphicsDrawImageRect($aTI[$g_hGraphics], $aTI[$g_hBitmap], 0, 0, 16, 16) _CreateTrayIcon() If @error Then Return SetError(@error, @extended, 0) Return 1 EndFunc ;==>_TIG_CreateTrayGraph ; #FUNCTION# ==================================================================================================================== ; Name...........: _TIG_SetBarColor ; Description ...: Sets Bar Color for tray icon ; Syntax.........: _TIG_SetBarColor($iBarColor = 0xFF00ACFF) ; Parameters ....: $iBarColor - Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB). Default = Blue ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 ; Author ........: Beege ; Remarks .......: None ; =============================================================================================================================== Func _TIG_SetBarColor($iBarColor = 0xFF00ACFF) If $iBarColor = -1 Or $iBarColor = Default Then $iBarColor = 0xFF00ACFF _GDIPlus_PenSetColor($aTI[$g_hPen], $iBarColor) If @error Then Return SetError(1, @extended, 0) Return 1 EndFunc ;==>_TIG_SetBarColor ; #FUNCTION# ==================================================================================================================== ; Name...........: _TIG_SetBackGoundColor ; Description ...: Sets BackGround Color for tray icon ; Syntax.........: _TIG_SetBackGoundColor($iBackColor = 0xFF000000) ; Parameters ....: $iBarColor - Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB). Default = Black ; Return values .: Success - 1 ; Author ........: Beege ; Remarks .......: None ; =============================================================================================================================== Func _TIG_SetBackGoundColor($iBackColor = 0xFF000000) If $iBackColor = -1 Or $iBackColor = Default Then $iBackColor = 0xFF000000 $aTI[$g_iBackColor] = $iBackColor Return 1 EndFunc ;==>_TIG_SetBackGoundColor ; #FUNCTION# ==================================================================================================================== ; Name...........: _TIG_UpdateTray ; Description ...: Update Tray Bar Graph with new Value ; Syntax.........: _TIG_UpdateTray($iValue) ; Parameters ....: $iValue - Value to update graph with ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - Value returned from _WinAPI_GetLastERROR() ; Author ........: Beege ; Remarks .......: None ; =============================================================================================================================== Func _TIG_UpdateTrayGraph($iValue) $aTI[$g_sValues] = $iValue & '|' & $aTI[$g_sValues] Local $iX = 15, $split = StringSplit($aTI[$g_sValues], '|') _GDIPlus_GraphicsClear($aTI[$g_hBuffer], $aTI[$g_iBackColor]) For $y = 1 To $split[0] _GDIPlus_GraphicsDrawLine($aTI[$g_hBuffer], $iX, (16 - _CalcValue($split[$y])), $iX, 16, $aTI[$g_hPen]) $iX -= 1 Next _GDIPlus_GraphicsDrawImageRect($aTI[$g_hGraphics], $aTI[$g_hBitmap], 0, 0, 16, 16) If $split[0] = 16 Then $aTI[$g_sValues] = StringLeft($aTI[$g_sValues], StringInStr($aTI[$g_sValues], '|', 0, -1) - 1) _CreateTrayIcon() If @error Then Return SetError(@error, @extended, 0) Return 1 EndFunc ;==>_TIG_UpdateTrayGraph ; #FUNCTION# ==================================================================================================================== ; Name...........: _TIG_SetRange ; Description ...: Sets Minimum and Maximum Y values of the Graph ; Syntax.........: _TIG_SetRange($iMin = 0, $iMax = 100) ; Parameters ....: $iMin - Minimum Y Value. Must be Greater than 0. ; $iMax - Maximum Y Value ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 Minimum Value Less than zero ; Author ........: Beege ; Remarks .......: None ; =============================================================================================================================== Func _TIG_SetRange($iMin = 0, $iMax = 100) If $iMin < 0 Then Return SetError(1, @extended, 0) If $iMin = -1 Or $iMin = Default Then $iMin = 0 If $iMax = -1 Or $iMax = Default Then $iMax = 100 $aTI[$g_iMin] = $iMin $aTI[$g_iMax] = $iMax Return 1 EndFunc ;==>_TIG_SetRange #EndRegion Public Functions #Region Internel Functions ; #FUNCTION# ==================================================================================================================== ; Name...........: _TraySetIcon ; Author ........: Yashied ; Modified ......: Beege ; =============================================================================================================================== Func _TraySetIcon() Static $tNOTIFYICONDATA = DllStructCreate('dword Size;hwnd hWnd;uint ID;uint Flags;uint CallbackMessage;ptr hIcon;') Static $p_tNOTIFYICONDATA = DllStructGetPtr($tNOTIFYICONDATA) DllStructSetData($tNOTIFYICONDATA, 'Size', DllStructGetSize($tNOTIFYICONDATA)) DllStructSetData($tNOTIFYICONDATA, 'hWnd', $aTI[$g_hGUI]) DllStructSetData($tNOTIFYICONDATA, 'ID', 1) DllStructSetData($tNOTIFYICONDATA, 'Flags', 2) ; NIF_ICON DllStructSetData($tNOTIFYICONDATA, 'hIcon', $aTI[$g_hIcon]) Local $Ret = DllCall($aTI[$g_hShell32], 'int', 'Shell_NotifyIcon', 'dword', 1, 'ptr', $p_tNOTIFYICONDATA) If @error Or $Ret[0] = 0 Then Return SetError(_WinAPI_GetLastError(), 0, 0) Return 1 EndFunc ;==>_TraySetIcon Func _CreateTrayIcon() Local $hclone = _GDIPlus_BitmapCloneArea($aTI[$g_hBitmap], 0, 0, 16, 16) Local $hIcon = DllCall($__g_hGDIPDll, 'int', 'GdipCreateHICONFromBitmap', 'ptr', $hclone, 'int*', 0) If $aTI[$g_hIcon] <> -1 Then _WinAPI_DestroyIcon($aTI[$g_hIcon]) $aTI[$g_hIcon] = $hIcon[2] _GDIPlus_BitmapDispose($hclone) _TraySetIcon() If @error Then Return SetError(@error, @extended, 0) EndFunc ;==>_CreateTrayIcon Func _CalcValue($iValue) If $iValue >= $aTI[$g_iMax] Then Return 16 If $iValue <= $aTI[$g_iMin] Then Return 0 Local $fPercent = $iValue / $aTI[$g_iMax] Switch Int($fPercent * 100) Case 8 To 98 Return Int($fPercent * 16) Case 98 To 100 Return 16 Case 1 To 7 Return 1 EndSwitch EndFunc ;==>_CalcValue Func _GdiExit() If $aTI[$g_hIcon] <> -1 Then _WinAPI_DestroyIcon($aTI[$g_hIcon]) _GDIPlus_GraphicsDispose($aTI[$g_hGraphics]) _GDIPlus_GraphicsDispose($aTI[$g_hBuffer]) _GDIPlus_BitmapDispose($aTI[$g_hBitmap]) _GDIPlus_PenDispose($aTI[$g_hPen]) DllClose($aTI[$g_hShell32]) _GDIPlus_Shutdown() EndFunc ;==>_GdiExit #EndRegion Internel Functions TIG.au3
    1 point
  3. Where have you read this wrong statement? As you can see in this script: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> AutoItSetOption("GuiOnEventMode", 0) $Form1 = GUICreate("Form1", 615, 320, -1, -1) $ListView1 = GUICtrlCreateListView("#|Shopping list", 0, 0, 610, 254) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 25) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150) GUICtrlCreateListViewItem("1|Apples", $ListView1) GUICtrlCreateListViewItem("2|Peaches", $ListView1) $Button1 = GUICtrlCreateButton("Let me click", 16, 272, 99, 25) $SubMenu = GUICtrlCreateContextMenu($ListView1) $Check =GUICtrlCreateMenuItem("Check", $SubMenu) GUISetState(@SW_SHOW, $Form1) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(0, "", "Hello") Case $Check ;MsgBox(0,"","Submenu Item Check it's working!") $sItem = StringReplace(StringTrimRight(GUICtrlRead(GUICtrlRead($ListView1)),1),'|', ' ') MsgBox(64, 'Selected: ', $sItem) EndSwitch WEnd are submenuitems also available with the GuiGetMsg mode!
    1 point
  4. @FrancescoDiMuro Done, in the end I wrote my own code to keep it simple but also linked to your post
    1 point
  5. Beege

    Tray Icon Bar Graph UDF

    Change that to $__g_hGDIPDll
    1 point
  6. @TheDcoder Something like this (I'm busy at work too!): A couple of samples when the use of Step parameter in a For...Next...Step loop could be useful
    1 point
  7. AlmarM

    _StringEncrypt Example.

    Hello, a time ago I made a _StringEncrypt example for someone who had problems with passwords. I tought i'd just share it with everyone. #include <String.au3> #include <EditConstants.au3> Global $Level = 2 ;1 - 10 Global $Pass = "autoit" ;Can be anything. For more information read '_StringEncrypt()' in the Helpfile. _Check() _Password() Func _Check() If FileExists(@ScriptDir & "\Saved Password.ini") And IniRead(@ScriptDir & "\Saved Password.ini", "Password", "Pass", "Not Found") <> "Not Found" Then $GetPassword = InputBox("* Password *", "Please enter the password", "", "*", 200, 130) $Read_Pass = IniRead(@ScriptDir & "\Saved Password.ini", "Password", "Pass", "Not Found") If _StringEncrypt(0, $Read_Pass, $Pass, $Level) == $GetPassword Then MsgBox(64, "* Succes *", "Password Correct.") _Main() Else MsgBox(16, "* ERROR *", "Wrong Password!") Exit EndIf EndIf EndFunc Func _Password() $GUI = GUICreate("* Set Password*", 170, 65, -1, -1) $Label = GUICtrlCreateLabel("Password:", 10, 10) $Input = GUICtrlCreateInput("", 65, 7, 100, "", $ES_PASSWORD) $Button = GUICtrlCreateButton("Set Password!", 10, 35, 150) GUISetState() While 1 $nMsg = GUIGetMsg() Select Case $nMsg = -3 Exit Case $nMsg = $Button $ReadPassword = GUICtrlRead($Input) $Encrypt = _StringEncrypt(1, $ReadPassword, $Pass, $Level) IniWrite(@ScriptDir & "\Saved Password.ini", "Password", "Pass", $Encrypt) MsgBox(64, "* Succes *", "Password Succesfully Set!") Exit EndSelect WEnd EndFunc Func _Main() $GUI = GUICreate("* Succes *", 170, 45, -1, -1) $Label = GUICtrlCreateLabel("Hi, and Welcome!" & @CRLF & "You entered the right password!", 10, 10) GUISetState() While 1 $nMsg = GUIGetMsg() Select Case $nMsg = -3 Exit EndSelect WEnd EndFunc AlmarM
    1 point
×
×
  • Create New...