Jump to content

Search the Community

Showing results for tags 'Using UDF by ProgAndy'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hi, I was looking for a way to assign icons to tray items - I found an UDF here: http://www.autoit.de/index.php?page=Thread&postID=163013 (german site). The UDF works so far... But I have some trouble if using it under MS-Windows XP or MS-Windows Vista/7 (only if the 'Themes' service is disabled): There's no space between tray icons and text (Untitled2.jpg); furthermore, the tray icons are inverted if you point to them with the mouse cursor (Untitled3.jpg). Only under MS-Windows Vista/7 with 'Themes' service started the tray icons look as they should (Untitled1.jpg). Maybe this is a OS limitation? Here's a reproducer: #include <Array.au3> #include <Constants.au3> #include <GUIMenu.au3> #include <WinAPI.au3> AutoItSetOption("TrayMenuMode", 1) ; Opt() Local $___TRAYITEMSETICON[1] Local $hTRAY_Item0 = TrayCreateItem("Exit") Local $tMsg = 0 _TrayItemSetIcon($hTRAY_Item0, @AutoItExe, 0, $___TRAYITEMSETICON) While 1 $tMsg = TrayGetMsg() Select Case $tMsg = $hTRAY_Item0 TrayItemSetState($tMsg, $TRAY_UNCHECKED) ExitLoop EndSelect Sleep(10) WEnd _TrayItemSetIcon_DeleteObject($___TRAYITEMSETICON) ; [http://www.autoit.de/index.php?page=Thread&postID=163013]. Func _TrayItemSetIcon($hWnd, $sIconFile, $sIconIndex, ByRef $aHwd) ; _WinAPI_DeleteObject($aHwd) Local $iReturn = 0 Local $hTrayItem = TrayItemGetHandle(ControlGetHandle("", "", $hWnd)) If $hTrayItem <> 0 Then Local $hIcon = DllStructCreate("ptr") If Not @error Then Local $iIcon = _WinAPI_ExtractIconEx($sIconFile, $sIconIndex, 0, DllStructGetPtr($hIcon), 1) If $iIcon <> 0 Then $hIcon = DllStructGetData($hIcon, 1) If Not @error Then Local $hDC1 = _WinAPI_GetDC(_WinAPI_GetDesktopWindow()) If $hDC1 <> 0 Then Local $iArrayIndex = 0 Switch (UBound($aHwd, 0) <> 1) Case True $aHwd = _ArrayCreate(0) ContinueCase Case Else ReDim $aHwd[UBound($aHwd) + 1] $aHwd[0] = UBound($aHwd) - 1 EndSwitch $iArrayIndex = $aHwd[0] ; ---------------------------------------------------------------------------------------------------- $aHwd[$iArrayIndex] = _WinAPI_CreateCompatibleBitmap($hDC1, 16, 16) If $aHwd[$iArrayIndex] <> 0 Then Local $hDC2 = _WinAPI_CreateCompatibleDC($hDC1) If $hDC2 <> 0 Then $iReturn = 1 _WinAPI_ReleaseDC(_WinAPI_GetDesktopWindow(), $hDC1) _WinAPI_SelectObject($hDC2, $aHwd[$iArrayIndex]) _WinAPI_DrawIconEx($hDC2, 0, 0, $hIcon, 16, 16, 0, _WinAPI_GetSysColorBrush(4), 3) ; Default tray background color. _WinAPI_DeleteDC($hDC2) _WinAPI_DestroyIcon($hIcon) _GUICtrlMenu_SetItemBmp($hTrayItem, $hWnd, $aHwd[$iArrayIndex], False) Else ; Error. SetError(7, 0) EndIf Else ; Error. SetError(6, 0) EndIf Else ; Error. SetError(5, 0) EndIf Else ; Error. SetError(4, 0) EndIf Else ; Error. SetError(3, 0) EndIf Else ; Error. SetError(2, 0) EndIf Else ; Error. SetError(1, 0) EndIf Return $iReturn EndFunc ;==>_TrayItemSetIcon Func _TrayItemSetIcon_DeleteObject(ByRef $aHwd) Local $iReturn = 1 If UBound($aHwd, 0) = 1 Then Local $iDeleteObject = 0 For $i = 1 To UBound($aHwd) - 1 Step 1 $iDeleteObject += _WinAPI_DeleteObject($aHwd[$i]) If Not $iDeleteObject Then $iReturn = 0 EndIf ConsoleWrite("_TrayItemSetIcon_DeleteObject(" & $aHwd[$i] & ") -> [" & $iDeleteObject & "][" & $iReturn & "]" & @CRLF) Next SetExtended($iDeleteObject) Else ; Error. $iReturn = 0 SetError(1, 0) EndIf Return $iReturn EndFunc ;==>_TrayItemSetIcon_DeleteObject Any help is welcome. Since other programs show good looking tray icons there should be a solution to that issue!? Greets, -supersonic.
×
×
  • Create New...