开发者

Use system tray & icons in VBA (Access)

开发者 https://www.devze.com 2022-12-22 01:58 出处:网络
I\'ve found a few tutorials that explain how to use the windows API to get a custom icon in the system tray.

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 a开发者_StackOverflow中文版lso 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号