使用系统托盘和VBA(访问)中的图标 [英] Use system tray & icons in VBA (Access)

查看:151
本文介绍了使用系统托盘和VBA(访问)中的图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了一些教程,它们解释了如何使用Windows API在系统任务栏中获取自定义图标.

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

这些都是针对Visual Basic的,它们似乎无法很好地扩展到VBA.

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

我正在关注这个简短的教程: http://atchoo.org/vb/systray.php

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

基本上,您必须设置hIcon值(长"变量),但是它不起作用. 我尝试使用LoadPicture()函数,该函数不会给我任何错误,但是也无法添加新图标.

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.

我无法提供Me.Icon,也无法在Form_Load上进行设置.

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

有人对此有任何经验吗?

Does anyone have any experience with this?

推荐答案

使用loadpicture是正确的方法,但不能直接使用. 我必须先定义一个新变量,然后加载它.

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

赞:

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

然后,在此过程中的某个地方,我可以毫无问题地设置hIcon:

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.

这篇关于使用系统托盘和VBA(访问)中的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆