Use the system tray and icons in VBA (Access)

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

All this is for Visual Basic, and they don't seem to scale for VBA.

I follow this short tutorial: http://atchoo.org/vb/systray.php

Basically, you should set the value to hIcon (the "long" variable), but it does not work. I tried using the LoadPicture () function, which does not give me any errors, but also cannot add a new icon.

I cannot provide Me.Icon, and I cannot set it to Form_Load.

Does anyone have any experience?

+1
vba winapi ms-access windows-shell
source share
1 answer

Using loadpicture was correct, but not direct. First I needed to define a new variable and load it.

Like this:

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

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

 .hIcon = myPicture 

When I change the tray (for example, adding balloontip), I have to provide the icon information again.

+3
source share

All Articles