Sign in to follow this  
Followers 0
Uten

Adding Icons To A Tray Menuitem (traycreateitem)

7 posts in this topic

#1 ·  Posted (edited)

I want to make a application launcher resting in the tray. When I click the TrayIcon I want to get a menu with the names of the applications and the icons assosiated with the application.

In my case the icon assosiated with the application must be extracted from the executable. It is not found in the registry.

If you use VC to make your programs I the function SHGetFileInfo (in shell32.dll) and friends would give you access to the icons (I belive?). But according to this thread Obtain icon associated with file type, two difficulties "DllCall(... "SHGetFileInfo" ...) will not work due to the structures requiered by the function".

So is there a simple slick autoit way to do this?

EDIT:

I have added a udf, TrayMenuEx to do this. Not a slick way, but sort of a solution in many cases.

Edited by Uten

Share this post


Link to post
Share on other sites



Have you tried just using the exe name?

Example:

$main = GUICreate('main')
GUICtrlCreateIcon(@ProgramFilesDir & '\AutoIt3\AutoIt3.exe', '', 10, 10)
GUISetState()
While 1
    If GUIGetMsg() = - 3 Then Exit
WEnd

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Have you tried just using the exe name?

Example:

$main = GUICreate('main')
GUICtrlCreateIcon(@ProgramFilesDir & '\AutoIt3\AutoIt3.exe', '', 10, 10)
GUISetState()
While 1
    If GUIGetMsg() = - 3 Then Exit
WEnd
Edit:

After reading your post again, I may be a tad off base :).


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Edit:

After reading your post again, I may be a tad off base :mellow:.

Ohh, If you only knew how I wish you were not :)

Do you (or anyone else) know if it is possible to get a handel or pointer to the icon (bmp) used by GUICtrlCreateIcon or set by GUICtrlSetImage?

EDIT: typo

Edited by Uten

Share this post


Link to post
Share on other sites

Ohh, If you only knew how I wish you were not :)

Do you (or anyone else) know if it is possible to get a handel or pointer to the icon (bmp) used by GUICtrlCreateIcon or set by GUICtrlSetImage?

EDIT: typo

If I understand you right just assign it a variable.

$Icon = GUICtrlCreateIcon(@ProgramFilesDir & '\AutoIt3\AutoIt3.exe', '', 10, 10)

Share this post


Link to post
Share on other sites

If I understand you right just assign it a variable.

$Icon = GUICtrlCreateIcon(@ProgramFilesDir & '\AutoIt3\AutoIt3.exe', '', 10, 10)
I'm afraid you misunderstod. This will return the controlID and not a pointer to the icon or bmp.

But if I knew how to get a handel to the icon/bmp used by controlID that could possibly be a solution.

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