流行软件的工具栏上的按钮是平的按钮,当鼠标移过时才会突起,这种效果采用贴图的方法实现十分麻烦,而利用api函数实现起来就很方便,快捷。实现的基本思路是:用sendmessage函数向工具栏发送设置显示样式tb_setstyle的消息来改变工具栏的显示效果。
我们先来声明api函数,本例中用到的两个函数声明如下:
private declare function findwindowex lib "user32" alias "findwindowexa" _ (byval hwnd1 as long, _ byval hwnd2 as long, _ byval lpsz1 as string, _ byval lpsz2 as string) as long private declare function sendmessage lib "user32" alias _ "sendmessagea" (byval hwnd as long, byval wmsg as long, _ byval wparam as integer, byval lparam as any) as long |
| lnghwnd = findwindowex(tbar.hwnd, 0&, "toolbarwindow32", vbnullstring) |
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器