Jump to content
Sign in to follow this  
careca

Image in traytip?

Recommended Posts

careca

Hey there, couldn't find anything on this, so i tried myself, but it doesn't work, here's what i got:

$aList = _RecFileListToArray($File1, "*.jpg;*.bmp;*.gif", 1, 0, 2, 2)
        If @error = 1 Then
            MsgBox(64, 'Notice', 'Couldnt find any images ')
        Else
            If IsArray($aList) Then
                For $u = 1 To $aList[0]
                    Local $Art = $aList[$u]
                    TrayTip('Playing', GUICtrlCreatePic($Art, -1, -1) & @CRLF & $File2, '', 1)
                Next
            EndIf
        EndIf

Forgot to mention, It finds the pics and all that, but the image appears in the main GUI, not in the traytip..

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
guinness

It's not possible. Search Toast UDF.

  • Like 1

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
careca

Oh, too bad, i've seen the toast udf, has some neat options, thank you.


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
guinness

You're welcome.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
UEZ

Here another way to create a fake traytip with option to display an image within.
 
This is an alpha version and just a proof of concept (needs still a lot of work)!

;coded by UEZ build 2013-05-13 alpha version

#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#include <StaticConstants.au3>


_GDIPlus_Startup()

Global $sText = "This is a fake traytip" & @CRLF & _
                "created with GDI+ :-)" & @CRLF & @CRLF & _
                "Coded by UEZ 2013"
Global $hImage = _GDIPlus_ImageLoadFromFile("c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif")

_GDIPlus_CreateTrayTip($sText, "Information", $hImage)

_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()

Func _GDIPlus_CreateTrayTip($sText, $sHeader, $hImage = 0, $sFont = "Arial", $fFontSize = 14, $iFontColor = 0xFF000000)
    Local $iBGColor = 0xFFFFFFFF
    Local $hPath = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", 0, "int*", 0)
    $hPath = $hPath[2]
    Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)
    ;measure text size
    DllCall($ghGDIPDll, "uint", "GdipAddPathString", "handle", $hPath, "wstr", $sHeader, "int", -1, "handle", $hFamily, "int", 0, "float", $fFontSize + 4, "struct*", $tLayout, "handle", 0)

    DllStructSetData($tLayout, "Y", $fFontSize * 2)
    DllCall($ghGDIPDll, "uint", "GdipAddPathString", "handle", $hPath, "wstr", $sText, "int", -1, "handle", $hFamily, "int", 0, "float", $fFontSize, "struct*", $tLayout, "handle", 0)
    Local $tRectF = DllStructCreate($tagGDIPRECTF)
    DllCall($ghGDIPDll, "uint", "GdipGetPathWorldBounds", "handle", $hPath, "struct*", $tRectF, "handle", 0, "handle", 0)

    ;create bitmap
    Local $iW = Floor(DllStructGetData($tRectF, 3)) + 90, $iH = Floor(DllStructGetData($tRectF, 4)) + $fFontSize + 15, $iPenSize = 1
    Local $hBitmap = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW + $iPenSize, "int", $iH + $iPenSize + 20, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
    $hBitmap = $hBitmap[6]
    Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2)
    DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hCtxt, "int", 4)
    DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "handle", $hCtxt, "int", 7)

    DllCall($ghGDIPDll, "uint", "GdipResetPath", "handle", $hPath)

    Local $iWin = 1, $bVisible = False, $iPosX

    Local $iIconIndex = _SysTrayIconIndex(@AutoItPID, 2, $iWin)

    Local $aPosIcon = _SysTrayGetButtonInfo($iIconIndex, $iWin, 4)
    If $iIconIndex > -1 Then
        $bVisible = True
        $iPosX = $aPosIcon[0]
        $iPosWinX = $aPosIcon[0]
        $iPosWinY = $aPosIcon[1]
    Else
        Local $aTaskbar = WinGetPos("[CLASS:Shell_TrayWnd;INSTANCE:1]", "")
        $iPosWinX = @DesktopWidth - $iW - 30
        $iPosWinY = $aTaskbar[1]
    EndIf

    ;draw ballon
    Local $iX = 0, $iY = 0, $iRadius = 20, $iDX, $iLimit

    DllCall($ghGDIPDll, "uint", "GdipAddPathArc", "handle", $hPath, "float", $iX + $iW - ($iRadius * 2), "float", $iY, "float", $iRadius * 2, "float", $iRadius * 2, "float", 270, "float", 90)
    DllCall($ghGDIPDll, "uint", "GdipAddPathArc", "handle", $hPath, "float", $iX + $iW - ($iRadius * 2), "float", $iY + $iH - ($iRadius * 2), "float", $iRadius * 2, "float", $iRadius * 2, "float", 0, "float", 90)

    If $bVisible > 0 Then
        $iDX = @DesktopWidth - ($iPosX + $iW + $iRadius + $iPenSize)
        If $iDX < 0 Then
            $iDX *= -1.15
            If $iDX > ($iW - $iRadius * 3) Then $iDX = $iW - $iRadius * 3
            If $iDX < $iRadius * 2 Then $iDX = 2 * $iRadius + 4
        ElseIf $iDX > $iW / 2 Then
            $iDX = $iW / 2
        EndIf
        DllCall($ghGDIPDll, "uint", "GdipAddPathLine", "handle", $hPath, "float", $iX + $iW - ($iRadius * 2), "float", $iY + $iH, "float", $iX + $iRadius + $iDX, "float", $iY + $iH)
        DllCall($ghGDIPDll, "uint", "GdipAddPathLine", "handle", $hPath, "float", $iX + $iRadius + $iDX, "float", $iY + $iH, "float", $iX + $iRadius + $iDX - 20, "float", $iY + $iH + 20)
        DllCall($ghGDIPDll, "uint", "GdipAddPathLine", "handle", $hPath, "float", $iX + $iRadius + $iDX - 20, "float", $iY + $iH + 20, "float", $iX + $iRadius + $iDX - 20, "float", $iY + $iH)
    EndIf

    DllCall($ghGDIPDll, "uint", "GdipAddPathArc", "handle", $hPath, "float", $iX, "float", $iY + $iH - ($iRadius * 2), "float", $iRadius * 2, "float", $iRadius * 2, "float", 90, "float", 90)
    DllCall($ghGDIPDll, "uint", "GdipAddPathArc", "handle", $hPath, "float", $iX, "float", $iY, "float", $iRadius * 2, "float", $iRadius * 2, "float", 180, "float", 90)
    DllCall($ghGDIPDll, "uint", "GdipClosePathFigure", "handle", $hPath)

    Local $hPen = _GDIPlus_PenCreate(0xFF000000, $iPenSize)
    DllCall($ghGDIPDll, "uint", "GdipDrawPath", "handle", $hCtxt, "handle", $hPen, "handle", $hPath)

    Local $hBrush = _GDIPlus_BrushCreateSolid($iBGColor)
    DllCall($ghGDIPDll, "uint", "GdipFillPath", "handle", $hCtxt, "handle", $hBrush, "handle", $hPath)

    DllCall($ghGDIPDll, "uint", "GdipResetPath", "handle", $hPath)

    ;draw text
    _GDIPlus_BrushSetSolidColor($hBrush, 0xFF0000FF)
    DllStructSetData($tLayout, "X", 60)
    DllStructSetData($tLayout, "Y", 10)
    DllCall($ghGDIPDll, "uint", "GdipAddPathString", "handle", $hPath, "wstr", $sHeader, "int", -1, "handle", $hFamily, "int", 0, "float", $fFontSize + 4, "struct*", $tLayout, "handle", 0)
    DllCall($ghGDIPDll, "uint", "GdipFillPath", "handle", $hCtxt, "handle", $hBrush, "handle", $hPath)
    DllCall($ghGDIPDll, "uint", "GdipResetPath", "handle", $hPath)
    _GDIPlus_BrushSetSolidColor($hBrush, $iFontColor)
    DllStructSetData($tLayout, "Y", $fFontSize * 2 + 10)
    DllCall($ghGDIPDll, "uint", "GdipAddPathString", "handle", $hPath, "wstr", $sText, "int", -1, "handle", $hFamily, "int", 0, "float", $fFontSize, "struct*", $tLayout, "handle", 0)
    DllCall($ghGDIPDll, "uint", "GdipFillPath", "handle", $hCtxt, "handle", $hBrush, "handle", $hPath)

    If $hImage Then _GDIPlus_GraphicsDrawImageRect($hCtxt, $hImage, $iRadius, $iRadius, 32, 32)

    DllCall($ghGDIPDll, "uint", "GdipDeletePath", "handle", $hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_GraphicsDispose($hCtxt)
    Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _GDIPlus_BitmapDispose($hBitmap)
    $iW += $iPenSize
    $iH += $iPenSize + 20

    ;create GUI
    Local $hGUI = GUICreate("", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW), $iBGTColor = 0x010101
    GUISetBkColor($iBGTColor)
    Local $iPic = GUICtrlCreatePic("", 0, 0, $iW, $iH)
    GUICtrlSetState(-1, $GUI_DISABLE)
    Local $iSizeBtn = 18
;~  Local $iBtn = GUICtrlCreateButton("X", $iW - $iRadius - $iSizeBtn, $iRadius, $iSizeBtn, $iSizeBtn, BitOR($BS_CENTER,$BS_VCENTER,$BS_FLAT))
    Local $iLabel = GUICtrlCreateLabel("X", $iW - $iSizeBtn - 4, $iSizeBtn, $iSizeBtn, $iSizeBtn, $SS_SIMPLE + $SS_CENTER)
    GUICtrlSetBkColor(-1, -2)
    Local $hB = GUICtrlSendMsg($iPic, 0x0172, 0, $hHBitmap)
    If $hB Then _WinAPI_DeleteObject($hB)
    _WinAPI_SetLayeredWindowAttributes($hGUI, $iBGTColor, 0x00)

    Local $aWin = WinGetPos($hGUI)
    WinMove($hGUI, "", $iPosWinX - ($iRadius + $iDX - 30), $iPosWinY - $iH + 20)
    GUISetState()

    For $i = 0 To 0xFF
        _WinAPI_SetLayeredWindowAttributes($hGUI, $iBGTColor, $i)
        Sleep(10)
    Next
    Local $iTimer = TimerInit(), $iTimerWait = 5
    Do
        Switch GUIGetMsg()
            Case $iLabel, $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
        If TimerDiff($iTimer) > $iTimerWait * 1000 Then ExitLoop
    Until False
    For $i = 0xFF To 0 Step - 2
        _WinAPI_SetLayeredWindowAttributes($hGUI, $iBGTColor, $i)
        Sleep(10)
    Next
    GUIDelete($hGUI)
    _WinAPI_DeleteObject($hHBitmap)
EndFunc

#region interanl functions
#region _Systray (Author: Tuape, Modified: Erik Pilsits -> build 5/13/2013)
Func _SysTrayIconCount($iWin = 1)
    Local Const $TB_BUTTONCOUNT = 1048
    Local $hWnd = _FindTrayToolbarWindow($iWin)
    If $hWnd = -1 Then Return -1
    Local $count = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", $TB_BUTTONCOUNT, "wparam", 0, "lparam", 0)
    If @error Then Return -1
    Return $count[0]
EndFunc   ;==>_SysTrayIconCount

Func _SysTrayIconTitles($iWin = 1)
    Local $count = _SysTrayIconCount($iWin)
    If $count <= 0 Then Return -1
    Local $titles[$count]
    For $i = 0 To $count - 1
        $titles[$i] = WinGetTitle(_SysTrayIconHandle($i, $iWin))
    Next
    Return $titles
EndFunc   ;==>_SysTrayIconTitles

Func _SysTrayIconPids($iWin = 1)
    Local $count = _SysTrayIconCount($iWin)
    If $count <= 0 Then Return -1
    Local $processes[$count]
    For $i = 0 To $count - 1
        $processes[$i] = WinGetProcess(_SysTrayIconHandle($i, $iWin))
    Next
    Return $processes
EndFunc   ;==>_SysTrayIconPids

Func _SysTrayIconProcesses($iWin = 1)
    Local $pids = _SysTrayIconPids($iWin)
    If Not IsArray($pids) Then Return -1
    Local $processes[UBound($pids)]
    Local $list = ProcessList()
    For $i = 0 To UBound($pids) - 1
        For $j = 1 To $list[0][0]
            If $pids[$i] = $list[$j][1] Then
                $processes[$i] = $list[$j][0]
                ExitLoop
            EndIf
        Next
    Next
    Return $processes
EndFunc   ;==>_SysTrayIconProcesses

Func _SysTrayIconIndex($test, $mode = 0, $iWin = 1)
    Local $ret = -1, $compare = -1
    If $mode < 0 Or $mode > 2 Or Not IsInt($mode) Then Return -1
    Switch $mode
        Case 0
            $compare = _SysTrayIconProcesses($iWin)
        Case 1
            $compare = _SysTrayIconTitles($iWin)
        Case 2
            $compare = _SysTrayIconPids($iWin)
    EndSwitch
    If Not IsArray($compare) Then Return -1
    For $i = 0 To UBound($compare) - 1
        If $compare[$i] = $test Then
            $ret = $i
            ExitLoop
        EndIf
    Next
    Return $ret
EndFunc   ;==>_SysTrayIconIndex

Func _SysTrayGetButtonInfo($iIndex, $iWin = 1, $iInfo = 1)
    Local Const $TB_GETBUTTON = 1047
    Local Const $TB_GETITEMRECT = 1053
    Local Const $ACCESS = BitOR(0x0008, 0x0010, 0x0400)
    Local $TBBUTTON
    If @OSArch = "X86" Then
        $TBBUTTON = DllStructCreate("int iBitmap;int idCommand;byte fsState;byte fsStyle;byte bReserved[2];dword dwData;int iString")
    Else
        $TBBUTTON = DllStructCreate("int iBitmap;int idCommand;byte fsState;byte fsStyle;byte bReserved[6];uint64 dwData;int64 iString")
    EndIf
    Local $TRAYDATA
    If @OSArch = "X86" Then
        $TRAYDATA = DllStructCreate("hwnd hwnd;uint uID;uint uCallbackMessage;dword Reserved[2];handle hIcon")
    Else
        $TRAYDATA = DllStructCreate("uint64 hwnd;uint uID;uint uCallbackMessage;dword Reserved[2];uint64 hIcon")
    EndIf
    Local $trayHwnd = _FindTrayToolbarWindow($iWin)
    If $trayHwnd = -1 Then Return SetError(1, 0, -1)
    Local $return, $err = 0
    Local $ret = DllCall("user32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $trayHwnd, "dword*", 0)
    If @error Or Not $ret[2] Then SetError(2, 0, -1)
    Local $pId = $ret[2]
    Local $procHandle = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $ACCESS, "bool", False, "dword", $pId)
    If @error Or Not $procHandle[0] Then Return SetError(3, 0, -1)
    Local $lpData = DllCall("kernel32.dll", "ptr", "VirtualAllocEx", "handle", $procHandle[0], "ptr", 0, "ulong", DllStructGetSize($TBBUTTON), "dword", 0x1000, "dword", 0x04)
    If Not @error And $lpData[0] Then
        $ret = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $trayHwnd, "uint", $TB_GETBUTTON, "wparam", $iIndex, "lparam", $lpData[0])
        If Not @error And $ret[0] Then
            DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $procHandle[0], "ptr", $lpData[0], "struct*", $TBBUTTON, "ulong", DllStructGetSize($TBBUTTON), "ulong*", 0)
            Switch $iInfo
                Case 2
                    DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $procHandle[0], "ptr", DllStructGetData($TBBUTTON, 6), "struct*", $TRAYDATA, "ulong", DllStructGetSize($TRAYDATA), "ulong*", 0)
                    $return = $TRAYDATA
                Case 3
                    $return = ""
                    If BitShift(DllStructGetData($TBBUTTON, 7), 16) <> 0 Then
                        Local $intTip = DllStructCreate("wchar[1024]")
                        DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $procHandle[0], "ptr", DllStructGetData($TBBUTTON, 7), "struct*", $intTip, "ulong", DllStructGetSize($intTip), "ulong*", 0)
                        $return = DllStructGetData($intTip, 1)
                    EndIf
                Case 4
                    If Not BitAND(DllStructGetData($TBBUTTON, 3), 8) Then
                        Local $pos[2], $RECT = DllStructCreate("int;int;int;int")
                        DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $trayHwnd, "uint", $TB_GETITEMRECT, "wparam", $iIndex, "lparam", $lpData[0])
                        DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $procHandle[0], "ptr", $lpData[0], "struct*", $RECT, "ulong", DllStructGetSize($RECT), "ulong*", 0)
                        $ret = DllCall("user32.dll", "int", "MapWindowPoints", "hwnd", $trayHwnd, "ptr", 0, "struct*", $RECT, "uint", 2)
                        $pos[0] = DllStructGetData($RECT, 1)
                        $pos[1] = DllStructGetData($RECT, 2)
                        $return = $pos
                    Else
                        $return = -1
                    EndIf
                Case Else
                    $return = $TBBUTTON
            EndSwitch
        Else
            $err = 5
        EndIf
        DllCall("kernel32.dll", "bool", "VirtualFreeEx", "handle", $procHandle[0], "ptr", $lpData[0], "ulong", 0, "dword", 0x8000)
    Else
        $err = 4
    EndIf
    DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $procHandle[0])
    If $err Then
        Return SetError($err, 0, -1)
    Else
        Return $return
    EndIf
EndFunc   ;==>_SysTrayGetButtonInfo

Func _SysTrayIconHandle($iIndex, $iWin = 1)
    Local $TRAYDATA = _SysTrayGetButtonInfo($iIndex, $iWin, 2)
    If @error Then
        Return SetError(@error, 0, -1)
    Else
        Return Ptr(DllStructGetData($TRAYDATA, 1))
    EndIf
EndFunc   ;==>_SysTrayIconHandle

Func _FindTrayToolbarWindow($iWin = 1)
    Local $hWnd, $ret = -1
    If $iWin = 1 Then
        $hWnd = DllCall("user32.dll", "hwnd", "FindWindow", "str", "Shell_TrayWnd", "ptr", 0)
        If @error Then Return -1
        $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "TrayNotifyWnd", "ptr", 0)
        If @error Then Return -1
        If @OSVersion <> "WIN_2000" Then
            $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "SysPager", "ptr", 0)
            If @error Then Return -1
        EndIf
        $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "ToolbarWindow32", "ptr", 0)
        If @error Then Return -1
        $ret = $hWnd[0]
    ElseIf $iWin = 2 Then
        $hWnd = DllCall("user32.dll", "hwnd", "FindWindow", "str", "NotifyIconOverflowWindow", "ptr", 0)
        If @error Then Return -1
        $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "ToolbarWindow32", "ptr", 0)
        If @error Then Return -1
        $ret = $hWnd[0]
    EndIf
    Return $ret
EndFunc   ;==>_FindTrayToolbarWindow
#endregion _Systray
#endregion

Has anybody an idea how to get the position of the tray icon in the taskbar to position the fake traytip appropriately?

Added _Systray UDF to get the tray icon position.

 
Br,
UEZ

Edited by UEZ
  • Like 1

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
careca

Wow, thanks!


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
guinness

UEZ you just gave me an idea. Thanks.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
PhoenixXL

@UEZ

We can find the position by this way

#include <SysTray_UDF.au3>  ;http://www.autoitscript.com/forum/topic/103871-systray-udf/?hl=+systray

$Icon_Index = _SysTrayIconIndex(@AutoItPID, 2)
$aPos_Icon = _SysTrayGetButtonInfo($Icon_Index, 1, 3)
If IsArray($aPos_Icon) = 0 Then Exit -1
_ArrayDisplay($aPos_Icon)

Width could be found by subtracting the X pos of the next item(specified by index)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
UEZ

@PhoenixXL: thanks for the hint. I got this UDF already on my disk...  :whistle: 

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×