Sign in to follow this  
Followers 0
muhmuuh

floating icon help

6 posts in this topic

Hi!

I want to create a floating icon for my program. Basically it will be a very small gui with just one picture in it that is always on top. I would be something like FlashGet's green icon if you know what I mean. So far so good but... I want to create a menu that will appear when I click the icon. I want to create a menu similar to the one that appears when I create a traymenu but that will appear when I click the icon. I can see when the icon is clicked by GUICtrlSetOnEvent but how can I create a menu similar to the tray menu? Please give me a hint where I should look

Thanks


I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Share this post


Link to post
Share on other sites



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

$icon = "Limewire.jpg" 

$smallGUI = GUICreate("SmallOnTopWindowThingo", 100, 100, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
$icon = GUICtrlCreatePic($icon, 0, 0, 100, 100, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
$menu = GUICtrlCreateContextMenu($icon)
$func1 = GUICtrlCreateMenuItem ("Function 1", $icon)
$func2 = GUICtrlCreateMenuItem ("Exit", $icon)

GUISetState()

While 1
    $nMsg = GUIGetMsg ()
    Switch $nMsg
        Case -3
            Exit
        Case $func1
            MsgBox (0,"", "Func 1!")
        Case $func2
            MsgBox (0,"", "Func 2!  Will now exit!")
    EndSwitch
WEnd

This was my picture. Bad transparency, but it works for the example :)

Posted Image

Share this post


Link to post
Share on other sites

...

Thanks alot

GUICtrlCreateMenuItem - how did I miss it?


I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Share this post


Link to post
Share on other sites

Brett's example is very good! To get a smoother transparency, use bmp files. You can also use Png images but it'll be a bit complicated to create a context menu.

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  
Followers 0