概要
<script type="text/javascript">loadTOCNode(1, 'summary');</script>
作为其子窗口的 ActiveX 控件可有工具栏 (CToolBar 类)。 本文说明如何创建这样一个工具栏和也如何实现工具提示有关按钮工具栏窗口上。
更多信息
<script type="text/javascript">loadTOCNode(1, 'moreinformation');</script>
VisualC++ 提供两种方法来创建工具栏。 文章 desribes 如何创建使用资源编辑器工具栏资源。 如果已经位图资源, 请参考到联机文档 " 转换位图到工具栏 " 用于位图资源转换为工具栏资源。
步骤如下:
步骤如下:
1. | 使用 MFC ActiveX 控件向导以生成 MFC ActiveX 控件。 |
2. | 该控件的项目中创建工具栏资源。 |
3. | 工具栏中添加工具提示字符串资源对每个按钮。 将 TTN _ NEEDTEXT 通知代码处理程序中加载这些提示字符串资源。 |
4. | WH_GETMESSAGE 挂钩回调函数添加到 ActiveX 控件派生类。 挂钩过程是负责是调用 PreTranslateMessage(), 应用程序中, 这导致调用 FilterToolTipMessage(), 其中激活提示。 因为 ActiveX 控件是像 inproc 服务器 ] [ ASCII 151 发现没有消息泵挂钩过程需要: |
5. | 创建工具栏窗口 (CToolBar 类), 它是子窗口的 ActiveX 控件。 这样以响应 WM _ CREATE 消息。 此外, WM _ CREATE 消息处理程序将也适于以安装 WH_GETMESSAGE 挂钩过程。 |
6. | 卸载消息挂钩函数以响应 WM_DESTROY 消息: |
7. | 添加到 ActiveX 控件派生类 TTN_NEEDTEXTW (对于 Unicode 通知代码) 或 TTN_NEEDTEXTA (对于 ANSI 通知代码) 通知处理程序。 加载此通知代码处理中要显示工具提示字符串: |