views:

293

answers:

1

I've found a few tutorials that explain how to use the windows API to get a custom icon in the system tray.

These are all for Visual Basic, and they don't seem to be scaling to VBA well.

I'm following this short tutorial: http://atchoo.org/vb/systray.php

Basically, you have to set the hIcon value (a 'long' variable) but it does not work. I've tried to use the LoadPicture() function, which does not give me any errors, but also fails to add a new icon.

I can't supply Me.Icon, nor can I set it on Form_Load.

Does anyone have any experience with this?

+2  A: 

Using loadpicture was the right approach, but not directly. I had to define a new variable first, and load that.

Like this:

Dim myPicture As IPictureDisp
strPath = "F:\Databank\Icons\stone.ico"
Set myPicture = LoadPicture(strPath)

And then, somewhere along the way, I could set hIcon without problems:

.hIcon = myPicture

When I change the trayicon (like, say, adding a balloontip) I have to supply the icon information again, too.

skerit
Good for you. Ta.
Remou