⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 01_9_17_11.asp.html

📁 有用的VC教程,包括编程思想编程技巧程序效率等方面的指导
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html><head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<TITLE>计算机世界网-在 Visual C++ 中 建 立 MFC 扩 展 DLL</TITLE></HEAD>
<style>
.a14{font-size:14px;text-indent:25px;line-height:20px}
.f{font-size:18px;color=#0f3ccd}
img{border:0px;}
td,p,input{font-fammily:verdana,宋体;font-size:12px;}
A:link {text-decoration:none;color:black}
A:visited {text-decoration:none;color:#80006f}
A:hover {text-decoration:underline;color:black}
</style>
<center>
<BODY topmargin=2 leftmargin=0>
<style>
.v12{font-size:10pt;color:"#ffffff";FONT-WEIGHT: bold}
.v14{font-size:14px;text-indent:25px;line-height:20px}
img{border:0px;}
td,p,input,select{font-fammily:verdana,宋体;font-size:12px;}
A:link {text-decoration:none;color:black}
A:visited {text-decoration:none;color:#80006f}
A:hover {text-decoration:underline;color:black}
</style>

<style>
.v13{font-size:10pt;color:"#ffffff";FONT-WEIGHT: bold}
.v12{font-size:13px;color:"#4C029C";FONT-WEIGHT: bold}
.v14{font-size:14px;text-indent:25px;line-height:20px}
img{border:0px;}
td,p,input,select{font-fammily:verdana,宋体;font-size:12px;}
A:link {text-decoration:none;color:black}
A:visited {text-decoration:none;color:#80006f}
A:hover {text-decoration:underline;color:black}
</style>

<!--头-->

<table align=center cellpadding="0" cellspacing="0" border="0" width="767">
  <tr><td valign=bottom>
      <table cellpadding="0" cellspacing="0" border=0>
        <tr><td valign=top><img src="../../../../../center/image/ccwlogo.gif"></td></tr>
        <tr><td height="27" valign=top><img src="../../../../../center/image/knowledge.gif" width="207" height="27"></td></tr>
      </table></td>
	<td valign=bottom width=556 bgcolor="#4c029c" height=96>
		  <table cellpadding="0" cellspacing="0" border=0 width=556 bgcolor="#4c029c" height=96>
        <tr><td height=25 valign=bottom bgcolor="#ffffff"  colspan=2 ><img src="../../../../../image2002/top.gif" usemap="#F"></td></tr>
	<tr  valign=middle >
		<td align=center valign=middle height="60" align=center>
		<!-- <a href="http://www.ccw.com.cn/search/" target=_blank><img src="../../../../../img2/esearch.GIF" border=0 width=468 height=60></a> --><a href="http://www.ccw.com.cn/html/search/thememail/" target=_blank><img src="../../../../../img2/topbanner_thememail.GIF" border=0 width=468 height=60></a>	
		</td>		
		<td  align=center width=15%>
			<table width=95%>
				<tr><td><a href="mailto:center@ccw.com.cn?subject=我要投稿:" target=_blank><font class=v13>我要投稿</a><br><a href="mailto:center@ccw.com.cn?subject=编读往来"><font class=v13>编读往来</a><br><a href="javascript:AddBookMark('计算机世界网首页')"><font class=v13>加入收藏</a></font></td></tr>
			</table>
		</td>
	</tr>
		<tr><td bgcolor="#ffffff" height=1 colspan=2 ></td></tr>
		<tr><td bgcolor="#b4aafc" height=2 colspan=2 ></td></tr></table>
		<map name="F">
<area href="http://www.ccw.com.cn/" shape="rect" coords="29, 3, 61, 18" target=_blank>
<area href="http://www.ccw.com.cn/news1/" shape="rect" coords="72, 3, 143, 18" target=_blank>
<area href="http://www.ccw.com.cn/center/" shape="rect" coords="155, 2, 216, 18" target=_blank>
<area href="http://www.ccw.com.cn/work/" shape="rect" coords="225, 2, 299, 18" target=_blank>
<area href="http://www.ccw.com.cn/search/" shape="rect" coords="310, 3, 364, 19" target=_blank>
<area href="http://www3.ccw.com.cn/" shape="rect" coords="372, 2, 412, 19" target=_blank>
<area href="http://www2.ccw.com.cn/" shape="rect" coords="424, 2, 550, 18" target=_blank></map>
	</td></tr>
	<tr><td colspan=2 bgcolor="#b4aafc">
	<table border=0 cellpadding=0 cellspacing=0 width=100%>
		<tr>
            <td width=26% align=center><font  class=v12>【2003年6月24日】&nbsp;&nbsp;&nbsp;</font></td>
            <td CLASS=V12> <a href="http://www.ccw.com.cn/center/topic.asp">专 题</a> /</td>
            <td CLASS=V12><a href="http://www.ccw.com.cn/center/tech.asp">技 术</a>  /</td>
            <td CLASS=V12><a href="http://www.ccw.com.cn/center/prod.asp">产 品</a> /</td>
            <td CLASS=V12><a href="http://www.ccw.com.cn/center/app.asp">应 用</a> /</td>
            <td CLASS=V12><a href="http://www.ccw.com.cn/center/net.asp">网 络</a> /</td>
            <td CLASS=V12><a href="http://www.ccw.com.cn/center/prog.asp">编 程</a> /</td>
            <td CLASS=V12><a href="http://www.ccw.com.cn/center/skill.asp">技 巧</a> </td>
         </tr>
	</table>
	</td></tr>
</table>
<table align=center width=728>
<tr><td align=center><br>
      <h2><font color='#0f3ccd'>在Visual C++ 中建立MFC扩展DLL</font></h2>
</td></tr><tr><td align=right>01-9-17 上午 10:46:21<br><hr size=1 width=718 color=#f46240></td></tr></table><br>
<table align=center width=728><tr><td valign=top width=600>
<table width=100% ><tr>
      <td class=a14><b>我 们 编 写 了 一 个 扩 展 类 的 样 例 并 将 其 封 装 在 DLL 中 以 向 你 演 示 该 
        过 程。 </b></td>
    </tr></table><table width=100% ><tr><td class=a14>
有 经 验 的 Windows 编 程 人 员 都 逐 渐 放 弃 了 Windows SDK, 而 转 向 能 为 Windows 内 置 的 低 级 机 制 提 供 高 级 抽 象 的 开 发 环 境。 这 种 转 移 的 一 个 主 要 受 益 者 是 Visual C++, 它 依 靠 MFC 库 来 提 供 Windows API 的 面 向 对 象 的 视 图。 </td></tr></table><table width=100% ><tr><td class=a14>
MFC 是 经 验 丰 富 的 编 程 人 员 掌 握 的 有 力 工 具, 但 它 离 完 美 还 相 距 甚 远。 事 实 上, 我 所 认 识 的 以 MFC 编 程 为 谋 生 手 段 的 人 都 开 发 了 他 或 她 自 己 的 扩 展 集 合, 他 们 以 MFC 类 作 为 基 础 类 来 派 生 自 己 的 类。 这 毕 竟 是 C++ 的 威 力。 如 果 某 个 类 不 能 满 足 你 的 需 求 ( 而 且 如 果 它 恰 好 可 以 作 为 设 计 的 开 始 ), 你 可 以 从 它 自 由 地 派 生 新 类 并 修 改 你 不 喜 欢 的 部 分。 </td></tr></table><table width=100% ><tr><td class=a14>
假 设 你 编 写 了 一 个 MFC 扩 展 集 合, 并 愿 意 与 公 司 的 其 它 开 发 人 员 共 享。 你 该 如 何 封 装 这 些 扩 展 呢? 你 可 以 分 发 源 代 码 文 件 或 与 Visual C++ 组 件 库(Component Gallery) 兼 容 的 组 件。 或 许 你 可 以 象 MFC 那 样 在 DLL 中 封 装 你 的 扩 展。 就 象 传 统 的 DLL 能 够 导 出 函 数 一 样, MFC 扩 展 DLL 可 以 导 出 类。 任 何 动 态 链 接 到 MFC DLL 的 应 用 程 序 都 能 动 态 链 接 到 MFC 扩 展 DLL。 作 为 开 发 者, 你 只 需 使 其 包 括 必 要 的 头 文 件 并 在 应 用 程 序 的 链 接 列 表 中 添 加 DLL 导 入 库。 </td></tr></table><table width=100% ><tr><td class=a14>
编 写 MFC 扩 展 DLL 困 难 吗? 有 了 Visual C++ 和 MFC 的 支 持, 这 实 际 非 常 轻 松。 本 文 解 释 了 如 何 创 建 MFC 扩 展 DLL 来 弥 补 MFC 的 CToolTipCtrl 类 的 明 显 不 足。 一 旦 意 识 到 其 简 便 性, 你 会 忍 不 住 亲 自 编 写 几 个 MFC 的 扩 展。 </td></tr></table><table width=100% ><tr>
      <td class=a14> <b>编 写 MFC 扩 展 DLL </b></td>
    </tr></table><table width=100% ><tr><td class=a14>
从 理 论 角 度 而 言, MFC 的 CTool-TipCtrl 类 简 化 了 将 提 示 信 息(ToolTip) 与 对 话 框 的 控 件 或 窗 口 的 任 意 区 域 相 关 联 的 过 程。 ( 提 示 信 息 是 当 鼠 标 光 标 停 滞 于 工 具 栏 按 钮 或 其 它 UI 对 象 时 弹 出 的 小 型 帮 助 文 本 窗 口。 ) 但 有 个 问 题 尚 待 解 决。 由 于 CToolTipCtrl::AddTool 不 能 自 动 成 为 提 示 信 息 依 附 的 窗 口 的 子 类, 因 此 鼠 标 事 件 必 须 手 工 转 交 给 提 示 信 息 控 制。 这 通 常 意 味 着 你 必 须 自 己 给 窗 口 建 立 子 类。 </td></tr></table><table width=100% ><tr><td class=a14>
如 果 你 给 CToolTipCtrl 对 象 下 的 提 示 信 息 控 制 传 送 了 正 确 的 标 志, 它 应 该 能 给 自 己 创 建 子 类 —— 这 显 然 是 被 MFC 设 计 组 忽 略 的 功 能。 幸 运 的 是, 该 疏 忽 并 不 难 以 纠 正。 只 要 从 CToolTipCtrl 类 中 派 生 出 一 个 类, 用 类 似 的 函 数 代 替 CToolTipCtrl::AddTool 即 可, 该 函 数 的 TTM_ADDTOOL 消 息 使 用 TOOLINFO 结 构, 它 的 uFlags 域 中 包 含 TTF_SUBCLASS 标 志。 更 好 的 方 式 是 用 两 个 函 数 代 替 它: 它 们 分 别 给 子 窗 口 和 矩 形 窗 口 区 域 添 加 提 示 信 息。 AddTool 函 数 同 时 支 持 两 者, 但 在 语 法 结 构 上 创 建 提 示 信 息 的 两 种 方 法 截 然 不 同。 </td></tr></table><table width=100% ><tr><td class=a14>
图 1 和 图 2 显 示 了 名 为 CToolTip-CtrlEx 的 CToolTipCtrl 的 派 生 类 的 源 代 码。 该 派 生 类 给 它 继 承 的 内 容 添 加 了 两 个 函 数, 其 一 CToolTipCtrl::AddWindow 将 提 示 信 息 与 子 窗 口 相 关 联, 其 二 AddRectangle 使 提 示 信 息 依 附 于 窗 口 的 矩 形 区 域。 这 两 个 函 数 都 使 用 了 TTF_SUBCLASS 标 志 以 使 提 示 信 息 的 创 建 过 程 尽 可 能 简 单。 假 设 m_tooltipCtrl 是 CToolTipCtrlEx 对 象, 给 控 制 ID 为 IDC_BUTTON 的 按 钮 添 加 提 示 信 息 就 非 常 容 易 了: </td></tr></table><table width=100% ><tr><td class=a14>
</td></tr></table><table width=100% ><tr><td class=a14>
    m_tooltipCtrl.AddWindow ( </td></tr></table><table width=100% ><tr><td class=a14>
</td></tr></table><table width=100% ><tr><td class=a14>
    GetDlgItem (IDC_BUTTON), </td></tr></table><table width=100% ><tr><td class=a14>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -