Jump to content

Open a Tray Icon?


Recommended Posts

:whistle: I tried searching the forum and the Help directory on this, but I am baffled. I have a program that starts as a tray icon which must manually be opened. My tray icons move periodically, so I cant mouseclick on the small icon to open it. It won't open with @SW_MAXIMIZE or any winsetstate commands. Can anyone help me do this? The program is called "EASY MESSAGE". I just have a hotkey command that I want to open it with and send quicky messages automatically. thanxs
Link to comment
Share on other sites

#Include <Constants.au3>
#include <GUIConstants.au3>
#NoTrayIcon
HotKeySet("{Home}", "_Show")

Opt ("TrayMenuMode", 1)  ; Default tray menu items (Script Paused/Exit) will not be shown.

$settingsitem = TrayCreateMenu("Settings")
$displayitem = TrayCreateItem("Display", $settingsitem)
$printeritem = TrayCreateItem("Printer", $settingsitem)
TrayCreateItem("")
$aboutitem = TrayCreateItem("About")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")

$gui = GUICreate("Background", 800, 300)
; background picture
$background = GUICtrlCreatePic("demo-bg.jpg", 0, 0, 800, 300)

; transparent child window
$pic = GUICreate("", 14, 80, 0, 0, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_MDICHILD, $gui)
; transparent pic
$basti_stay = GUICtrlCreatePic("l_st.gif", 0, 0, 14, 80)

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $aboutitem
            MsgBox(64, "About:", "AutoIt3-Tray-sample")
        Case $msg = $exititem
            ExitLoop
    EndSelect
WEnd

Exit

Func _Show()
    GUISetState(@SW_SHOW, $gui)
; Run the GUI until the dialog is closed
    While 1
        $msg2 = GUIGetMsg()
        Select
            Case $msg2 = $GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
    WEnd
    GUISetState(@SW_HIDE, $gui)
EndFunc  ;==>_Show

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

#Include <Constants.au3>
#include <GUIConstants.au3>
#NoTrayIcon
HotKeySet("{Home}", "_Show")

Opt ("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.

$settingsitem = TrayCreateMenu("Settings")
$displayitem = TrayCreateItem("Display", $settingsitem)
$printeritem = TrayCreateItem("Printer", $settingsitem)
TrayCreateItem("")
$aboutitem = TrayCreateItem("About")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")

$gui = GUICreate("Background", 800, 300)
; background picture
$background = GUICtrlCreatePic("demo-bg.jpg", 0, 0, 800, 300)

; transparent child window
$pic = GUICreate("", 14, 80, 0, 0, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_MDICHILD, $gui)
; transparent pic
$basti_stay = GUICtrlCreatePic("l_st.gif", 0, 0, 14, 80)

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $aboutitem
            MsgBox(64, "About:", "AutoIt3-Tray-sample")
        Case $msg = $exititem
            ExitLoop
    EndSelect
WEnd

Exit

Func _Show()
    GUISetState(@SW_SHOW, $gui)
; Run the GUI until the dialog is closed
    While 1
        $msg2 = GUIGetMsg()
        Select
            Case $msg2 = $GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
    WEnd
    GUISetState(@SW_HIDE, $gui)
EndFunc ;==>_Show

<{POST_SNAPBACK}>

:whistle: thanks for the info..i will try now. I am still learning

Link to comment
Share on other sites

:whistle: I tried the systray_udf.au3 as you recommended...just getting an UNKNOWN FUNCTION NAME IN LINE 71 ..If $info[$i] = HWnd($var[$j][1]) Then..

i am using recent beta release of two days ago.  can I ask more help or should I contact Taupe

<{POST_SNAPBACK}>

You would be best to contact Tuape. I only suggested this as it helped me fix a problem that I had.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

:whistle: got it now..thanks

<{POST_SNAPBACK}>

Yes, there was a change in 3.1.66 which made me have to change the code a bit. Unfortunately it doesn't work with earlier versions any more. If you need a version that works with earlier betas, I can PM it to you.

It seems that you got it working though.

Link to comment
Share on other sites

Yes, there was a change in 3.1.66 which made me have to change the code a bit. Unfortunately it doesn't work with earlier versions any more. If you need a version that works with earlier betas, I can PM it to you.

It seems that you got it working though.

<{POST_SNAPBACK}>

yes, it was quite helpful. it will stay in my utility folder as a useful tool :whistle:
Link to comment
Share on other sites

Yes, there was a change in 3.1.66 which made me have to change the code a bit. Unfortunately it doesn't work with earlier versions any more. If you need a version that works with earlier betas, I can PM it to you.

It seems that you got it working though.

<{POST_SNAPBACK}>

I still wish you would provide me with an example of what worked before but what does not work now (Simple as possible). I'm not convinced without seeing proof that anything should of been broken (Aside from what I intentionally broke). Please show me a small example of what was working before and what does not work now. Yes, I know I made changes in this area, but without seeing the code you had, I don't know if these changes are in fact a regression. I would like to be sure, at least.
Link to comment
Share on other sites

I still wish you would provide me with an example of what worked before but what does not work now (Simple as possible).  I'm not convinced without seeing proof that anything should of been broken (Aside from what I intentionally broke).  Please show me a small example of what was working before and what does not work now.  Yes, I know I made changes in this area, but without seeing the code you had, I don't know if these changes are in fact a regression.  I would like to be sure, at least.

<{POST_SNAPBACK}>

I think you have to take a look at the rest of the code. Anyway, prior .66 I did compare handles returned by dllcall to ones returned by WinList() like this:

$var = WinList()
    For $i = 0 to $max-1
        For $j = 1 to $var[0][0]
            If $info[$i] = Dec($var[$j][1]) Then

$info[$i] contains handle from DllStruct ("dword[2]").

It stopped working on .66 when hWnd() was introduced. To fix that I just needed to change Dec() to Hwnd().

I'm not saying something was broken, I'm just saying things did work differently.

Link to comment
Share on other sites

I think you have to take a look at the rest of the code. Anyway, prior .66 I did compare handles returned by dllcall to ones returned by WinList() like this:

$var = WinList()
    For $i = 0 to $max-1
        For $j = 1 to $var[0][0]
            If $info[$i] = Dec($var[$j][1]) Then

$info[$i] contains handle from DllStruct ("dword[2]").

It stopped working on .66 when hWnd() was introduced. To fix that I just needed to change Dec() to Hwnd().

I'm not saying something was broken, I'm just saying things did work differently.

<{POST_SNAPBACK}>

Ahhh! Yes, that was broken intentionally. However, it is a bug, IMO, that Dec can't handle a text string in the form "0x0000" but only accepts "0000".

Actually, the bug is in my HWND code somewhere and how its treated as a string. There is a significantly larger issue at hand than just being unable to use Dec(). Your code should of worked (Without change) and I thought as much. There is something else amiss that I will have to figure out.

Edited by Valik
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...