nitekram

TrayCreateItem (can you popup a pic?)

4 posts in this topic

Looked around, but could not find anything, and thought I would just ask if it was possible. Looking to pop a png or jpg file on hover over a TrayCreateItem - is that possible (similar to HTML, where you hover over an item, and either a larger pic or a different pic shows while hover (just as a reference to what I am looking to achieve)?


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites




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

I am looking at that, but having some issues with it, as I do not have a GUI, it is all in the tray. I have got it to pop to the center, but after that it just stays there - I think if I change the GUICreate, so that it has a exit button it may work...still looking into it - thanks for the link

 


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

I do not believe I have created what I want, but here is as far as I got...

 

#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <array.au3>
Opt("MustDeclareVars", 1)
Opt("TrayMenuMode", 3)


Global Const $STM_SETIMAGE = 0x0172
Global $sPathKey = "HKLM64\SOFTWARE\AutoIt v3\AutoIt\"
If @OSArch = "x64" Then $sPathKey = "HKLM\SOFTWARE\Wow6432Node\AutoIt v3\AutoIt\"
Global $sImage1 = RegRead($sPathKey, "InstallDir") & "\Examples\GUI\msoobe.jpg"
Global $sImage2 = RegRead($sPathKey, "InstallDir") & "\Examples\GUI\Torus.png"

Global $hGui_PreviewSize = 200, $iBGColor = 0xF0F0F0

Global $aMouseInfo, $aPosCtrl, $aPosWin, $hBmp_Tmp, $sFile, $bShow = False, $bHide = False

_GDIPlus_Startup()
TrayCreateItem("")
Global $tmPhone = TrayCreateMenu('PHONE DOCS')
TrayCreateItem('ONCALL List', $tmPhone)
Global $t101 = TrayCreateItem('101', $tmPhone)
;TrayItemSetState(-1, $GUI_DISABLE)
Global $tSOP = TrayCreateItem('SOP', $tmPhone)
;TrayItemSetState(-1, $GUI_DISABLE)
Global $tEXIT = TrayCreateItem('Exit', $tmPhone)
;TrayItemSetState(-1, $GUI_DISABLE)

Global $hGui_Preview = GUICreate("", $hGui_PreviewSize, $hGui_PreviewSize + 58, -1, -1, -1, $WS_EX_TOPMOST) ;$WS_POPUP + $WS_BORDER, $WS_EX_TOPMOST)
Global $idPic = GUICtrlCreatePic("", 0, 0, $hGui_PreviewSize, $hGui_PreviewSize)
Global $idLabel_Info = GUICtrlCreateLabel("", 0, $hGui_PreviewSize + 8, $hGui_PreviewSize * 2, 50)
GUICtrlSetFont(-1, 9, 400, 0, "Arial", 5)
GUICtrlSetColor(-1, $iBGColor)
GUICtrlSetBkColor(-1, 0x222222)
GUISetState(@SW_HIDE, $hGui_Preview)

Global $hGui_PreviewSize = 200, $iBGColor = 0xF0F0F0

While 1
    Switch TrayGetMsg()
        Case $tSOP
            ConsoleWrite('fadfadf')
            ;MsgBox('','','')
            ShowPreview($sImage1, $tSOP)
        Case $tEXIT
            ;If $hBmp_Tmp Then _WinAPI_DeleteObject($hBmp_Tmp)
            _GDIPlus_Shutdown()
            Exit
    EndSwitch
WEnd

Func ShowPreview($sFile, $iCtrl = '')
    ;$aPosWin = WinGetPos($tmPhone)
    $aPosCtrl = ControlGetPos($tmPhone, "", $iCtrl)
    _ArrayDisplay($aPosCtrl)
    ;WinMove($tmPhone, "", $aPosWin[0] + $aPosCtrl[0] + $aPosCtrl[2], $aPosWin[1] + $aPosCtrl[1] + $aPosCtrl[3])
    $hBmp_Tmp = _GetImage($sFile, $hGui_PreviewSize, $iBGColor)
    ;_hBmpToPicControl($idPic, $hBmp_Tmp, 1)
    GUISetState(@SW_SHOWNOACTIVATE, $hGui_Preview)
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE

                GUISetState(@SW_HIDE, $hGui_Preview)
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>ShowPreview

Func _GetImage($sFile, $iWH, $iBkClr = 0xFFFFFF)
    Local $hBmp1, $hBitmap, $hGraphic, $hImage, $iW, $iH, $aGS, $hBmp2, $aFTS
    $aFTS = FileGetTime($sFile)
    If @error Then Return SetError(1, 0, 0)
    $hBmp1 = _WinAPI_CreateBitmap($iWH, $iWH, 1, 32)
    $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp1)
    $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _WinAPI_DeleteObject($hBmp1)
    _GDIPlus_GraphicsClear($hGraphic, BitOR(0xFF000000, $iBkClr))
    $hImage = _GDIPlus_ImageLoadFromFile($sFile)
    $iW = _GDIPlus_ImageGetWidth($hImage)
    $iH = _GDIPlus_ImageGetHeight($hImage)
    GUICtrlSetData($idLabel_Info, StringRegExpReplace($sFile, ".*\\(.*)", "$1") & @LF & Round(FileGetSize($sFile) / 1024, 0) & " kb (" & $iW & " x " & $iH & ")" & @LF & $aFTS[0] & "/" & $aFTS[1] & "/" & $aFTS[2] & " " & $aFTS[3] & ":" & $aFTS[4] & ":" & $aFTS[5])
    $aGS = _GetScale($iW, $iH, $iWH)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, $aGS[0], $aGS[1], $aGS[2], $aGS[3])
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphic)
    $hBmp2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _GDIPlus_BitmapDispose($hBitmap)
    Return $hBmp2
EndFunc   ;==>_GetImage

Func _GetScale($iW, $iH, $iWH)
    Local $aRet[4]
    If $iW <= $iWH And $iH <= $iWH Then
        $aRet[2] = $iW
        $aRet[3] = $iH
        $aRet[0] = ($iWH - $aRet[2]) / 2
        $aRet[1] = ($iWH - $aRet[3]) / 2
    ElseIf $iW > $iH Then
        $aRet[2] = $iWH
        $aRet[3] = $iH / ($iW / $iWH)
        $aRet[0] = 0
        $aRet[1] = ($iWH - $aRet[3]) / 2
    ElseIf $iW < $iH Then
        $aRet[2] = $iW / ($iH / $iWH)
        $aRet[3] = $iWH
        $aRet[0] = ($iWH - $aRet[2]) / 2
        $aRet[1] = 0
    ElseIf $iW = $iH Then
        $aRet[2] = $iWH
        $aRet[3] = $iWH
        $aRet[0] = 0
        $aRet[1] = 0
    EndIf
    Return $aRet
EndFunc   ;==>_GetScale

Func _hBmpToPicControl($iCID, ByRef $hBmp, $iFlag = 0)
    Local Const $STM_SETIMAGE = 0x0172
    Local Const $IMAGE_BITMAP = 0
    Local $hOldBmp
    $hOldBmp = GUICtrlSendMsg($iCID, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp)
    If $hOldBmp Then _WinAPI_DeleteObject($hOldBmp)
    If $iFlag Then _WinAPI_DeleteObject($hBmp)
EndFunc   ;==>_hBmpToPicControl

And this does not do your code justice lol, as I belive I could do the same thing, with just creating the regular gui for this.


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

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

  • Similar Content

    • nitekram
      By nitekram
      I have tried _GUIToolTip_AddTool() & GUICtrlSetTip() & TrayItemGetHandle()  but have had no luck...is there a way that I have missed, or is it not possible to create a ToolTip for an individual item in the Tray?
    • TrickyDeath
      By TrickyDeath
      Hello everyone,
      i do have a simple question what i do not realy understand what hapend and why.
      I did made a small program, what is converting Valuta prices to other type, cause i got tired of use all the time google for it. After that i "convert" it into an exe file. All the Valute prices are in INI file, and work perfect.
      I did made another small script (Tray menu) and then when i click on the proper TrayItem it should run the Valute exchanger exe file, but something is wrong. The exe is running, but when i calculate with it, it give me only 0 resoults. If i run the exe manualy it is work properly. How does it come, from Tray menu item wont work, and from manualy run it work hot it have to work?
      Case $iValutaCalculator Run("C:\Users\asd\Desktop\EU_USD.exe") Best Regards,
      Tricky
    • johnmcloud
      By johnmcloud
      Hi guys, i have this script:

      #NoTrayIcon #include <GuiConstantsEx.au3> #include <Constants.au3> Global $About, $Exit Opt("TrayOnEventMode", 1) Opt("TrayMenuMode", 3) TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "SpecialEvent") TraySetOnEvent($TRAY_EVENT_SECONDARYUP,"TrayMenu") GUICreate("TestGUI", 392, 316, -1, -1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_MINIMIZE GUISetState(@SW_HIDE) TraySetState(1) ; show Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Func TrayMenu() Local $About = TrayCreateItem("About") TrayCreateItem("") ; Create a separator line. Local $Exit = TrayCreateItem("Exit") While 1 Switch TrayGetMsg() Case $About MsgBox(0,0,"Test") Case $Exit ; Exit the loop. ExitLoop EndSwitch WEnd EndFunc Func SpecialEvent() GUISetState(@SW_SHOW) TraySetState(2) ; hide EndFunc ;==>SpecialEvent
      I want to minimize the GUI ( work ) and, when minimized, add a menu to the tray icon ( i see the menù but don't work )

      Second question, i have a Func with a MsgBox at the end. I'd like to have a MsgBox only if the GUI isn't minimized, so how to check the status of the GUI? Example if not minimized do a MsgBox, if is minimized do a TrayTip.

      Thanks for support
    • johnmcloud
      By johnmcloud
      Hi guys, i have this script:


      #NoTrayIcon Opt("TrayMenuMode",1) $prefsitem = TrayCreateItem("Preferences") TrayCreateItem("") $aboutitem = TrayCreateItem("About") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $prefsitem Msgbox(64, "Preferences:", "Test") Case $msg = $aboutitem Msgbox(64, "About:", "Test") Case $msg = $exititem ExitLoop EndSelect WEnd Exit
      From help, i see there is only two option for TrayCreateItem, "Normal" and "Radio"
      It's possible to have a version without the radio and the flag?
      Thanks for support