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

📄 写出vc动态连接库的方法之一 vc编程 vc编程 lucksyw_bokee_com.htm

📁 从网上下载的关于学习动态链接库的连载教程
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<DIV class=entry-title onclick=resize(this)>
<DIV class=lt>
<H2>写出vc动态连接库的方法之一</H2><INPUT id=search-key type=hidden value=写出vc动态连接库的方法之一 
name=search-key> </DIV>
<DIV class="rl entry-titlerl fenlei-Span">分类:<A 
href="http://lucksyw.bokee.com/cat.10471199.html">VC编程</A></DIV></DIV>
<DIV class="entry-body nerr">用VC++6.0制作动态链接库的步骤 : 
<BR>动态链接库(dll)是包含共享函数库的二进制文件,可以被多个应用程序同时使用。建立应用程序的可执行文件时,不必将DLL连接到应用程序中,而是在运行时动态装载DLL,装载时DLL被映射到调用进程的地址空间中。通常我们在调用DLL时所需的DLL文件必须位于以下三个目录之一: 
<BR>(1)Windows的系统目录:\windows\system; <BR>(2)DOS 中path所指出的任何目录; <BR>(3)程序所在的目录; 
<BR>本设计用的是第三种。 <BR>3.2.1动态链接库(DLL)结构 <BR>1.实现文件(.cpp文件为例) 
<BR>包含DLL入口点处理函数和导出函数,以及被导出函数调用的函数的代码。 <BR>格式如下: <BR>#include "stdafx.h" 
//加入所使用的相关头文件 <BR>#include "oil.h" <BR>#include "stdio.h" <BR>#include 
"stdlib.h" <BR>#include "math.h" <BR>BOOL APIENTRY DllMain( HANDLE hModule, 
<BR>DWORD ul_reason_for_call, <BR>LPVOID lpReserved <BR>) <BR>{ <BR>return TRUE; 
<BR>} <BR>以下为各函数:(被调用函数和导出函数之一) <BR>void WINAPI sub(double a, double b, double 
c) <BR>注:DLLMain 表示在Windows中DLL开始执行的地方。 
<BR>2.模块定义文件(.DEF)是由一个或多个用于描述DLL属性的模块语句组成的文本文件,每个.DEF文件至少必须包含以下模块定义语句: 
<BR>第一个语句必须是LIBRARY语句,指出DLL的名字。 <BR>EXPORTS 语句列出被导出函数的名字。 
<BR>可以使用DESCRIPTION语句描述DLL的用途(此句可选)。 <BR>格式如下: <BR>EXPORTS HanL @1 
<BR>3.函数原型声明文件(.h文件为例) <BR>以以下格式写入: <BR>#ifdef _cplusplus <BR>extern"c" <BR>{ 
<BR>#endif //_cplusplus <BR>double WINAPI sub( double a ,double b ,double c ); 
//函数原型 <BR>#ifdef _cplusplus <BR>} <BR>#endif //_cplusplus <BR>注意: <BR>(1) 
c语言中须在调用函数前面声明或定义该函数,调用才能成功。在c中,函数原型通常和函数定义很相似,只不过原型以分号结尾。在c中原型仅仅用于类型检验。 <BR>(2) 
建立函数原型:.h文件。.h文件可包含c或c++模块中,正如能从ifdef 
看出的一样,若代码在c文件中,则不使用extern“c”语句,但作为一个c++文件进行编译,则需要使用。 
<BR>(3)使用CPP文件(C++),则须防止C++引起的过多的名称修饰,为避免C++的名称修改,可使用extern“c”定义。extern”c”是C程序提供外部连接的方式,在C++代码中提供Visual 
Basic程序的链接,须使用extern”c”链接声明,这样定义的文件就可以使得其函数能被Visual Basic访问。 <BR>4.2.2创建oil.dll 
<BR>1.创建oil.dll的工程,启动VC++6.0按以下步骤生成DLL工程: <BR>在菜单中选择File\New\Project 
<BR>在工程列表中选择Win32 Dynamic-Link Library <BR>在Project Name中输入工程名: oil 
<BR>单击Location右边按钮,选择 “F:\李帆设计”目录 <BR>单击OK完成,至此已创建了oil.dll的工程文件 
<BR>2.创建oil.def文件 <BR>在菜单中选择File\New\Text File。输入以下代码后保存文件名"oil.def" 
//指出DLL的名字oil,链接器将这个名字放到DLL导入库中 <BR>LIBRARY oil //定义导出函数suanfa()为例 <BR>EXPORTS 
HanL @1 <BR>3.创建oil.h <BR>在菜单中选择File\New\C++ Head File项 <BR>输入代码后保存文件名" oil.h" 
<BR>4.填写oil.cpp文件,输入代码后保存文件名“oil.cpp”。 <BR>5.编译DLL文件 ---- 从Build菜单中选择Build 
oil.DLL,产生oil.DLL文件,以后就可以调用了。</CA> </DIV>
<P id=trackback>你可以通过这个链接引用该篇文章:http://lucksyw.bokee.com/tb.b?diaryId=14070561 
</P>
<DIV class=entry-footer><SPAN class=f><SPAN class=pub-date 
title=发布日期>2006.12.16</SPAN> <SPAN class=pub-time title=发布时间>11:19</SPAN> <SPAN 
class=ln-author>作者:<A class=author 
href="http://id.bokee.com/showInfo.b?username=lucksyw.bokee.com">lucksyw</A></SPAN> 
</SPAN><SPAN class=f>
<SCRIPT>if(blogID!=null){document.writeln('<a class="ln-trackbacks" href=\"http://'+blogID+'/trackback/doTrackDiary.b?trackDiaryUrl=http://lucksyw.bokee.com/trackback/trackDiary.b?diaryId=14070561\">引用:0</a> | ');}</SCRIPT>
<A class=ln-bookmark 
href="javascript:addFavorite('写出vc动态连接库的方法之一','http://lucksyw.bokee.com/viewdiary.14070561.html');">收藏</A> 
| <A class=ln-comments 
href="http://lucksyw.bokee.com/viewdiary.14070561.html#remark">评论:0</A> | <SPAN 
class=ln-viewed id=h14070561>阅读:0</SPAN>
<SCRIPT>
						putDiary($('h14070561'));
						</SCRIPT>
 </SPAN></DIV></DIV>
<SCRIPT>statDiaryHit('lucksyw');</SCRIPT>
<!-- 金行广告 -->
<DIV class=operation id=shoulashou>
<H3 class=select>
<P class=newly-title><SPAN class=newly-Img><IMG 
src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/ico_wodeguanggao.gif"></SPAN>我的广告</P></H3>
<DIV class=col-body>
<DIV class=newly-right>
<SCRIPT src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/bi.htm"></SCRIPT>
</DIV></DIV>
<DIV class=newly-bot>
<DIV class=newly-bot01></DIV></DIV></DIV>
<DIV class=operation>
<H3 class=select>
<P class=newly-title><SPAN class=newly-Img><IMG 
src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/ico_wenzhangpinglun.gif"></SPAN>我的搜索</P></H3>
<DIV class=col-body>
<DIV class=newly-right>
<FORM name=gform action=http://www.google.cn/search method=get target=_top>
<TABLE bgColor=#ffffff border=0>
  <TBODY>
  <TR>
    <TD vAlign=top noWrap align=left 
      height=32><!-- Clickable Google Logo --><A 
      href="javascript:submitFormWithChannel('logo')"><IMG height=23 alt=Google 
      src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/logo_Google.gif" 
      width=75 align=middle border=0> 
    </A><!-- END of Clickable Google Logo --></TD>
    <TD noWrap><!-- Google Web Union Search Box --><INPUT maxLength=255 
      size=24 name=q> </INPUT><INPUT onclick="javascript:document.getElementById('channel').value='sitesearch';document.getElementById('sitesearch').value='bokee.com';document.getElementById('gform').submit();" type=button value=站内搜索 name=sb> 
      </INPUT><INPUT onclick="javascript:document.getElementById('channel').value='internetsearch';document.getElementById('sitesearch').value='';document.getElementById('gform').submit();" type=button value=搜索 name=sa> 
      </INPUT><INPUT id=sitesearch type=hidden name=sitesearch> <INPUT 
      type=hidden value=aff-bokee name=client> </INPUT><INPUT type=hidden 
      value=gbk name=ie> </INPUT><INPUT type=hidden value=gbk name=oe> 
      </INPUT><INPUT type=hidden value=zh-CN name=hl> </INPUT><INPUT id=channel 
      type=hidden value=search name=channel> </INPUT></TD></TR>
  <TR>
    <TD></TD>
    <TD 
noWrap><!-- End of Google Web Union Search Box --></TD></TR></TBODY></TABLE></FORM></DIV></DIV>
<DIV class=newly-bot>
<DIV class=newly-bot01></DIV></DIV></DIV><!-- 文章评论 -->
<DIV class=operation id=comment>
<H3 class=select>
<P class=newly-title><SPAN class=newly-Img><IMG 
src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/ico_wenzhangpinglun.gif"></SPAN>文章评论</P></H3>
<DIV class=col-body>
<DIV class=newly-right>
<DIV class="cmea pad-Left" id=cmt-area>
<H4>添加评论</H4>
<FORM name=remark onsubmit="return remarkSubmit();" action=/remark/remark.b 
method=post><INPUT type=hidden value=BokeeToken name=webwork.token.name> <INPUT 
type=hidden value=5TUKMEKC6G6FTJECJ23KSH3MUJJWLQ9B name=BokeeToken> <INPUT 
type=hidden value=D name=blogRemark.remarkType> <INPUT type=hidden 
value=14070561 name=blogRemark.objectId> <INPUT type=hidden 
value=lucksyw.bokee.com name=blogRemark.blogId> 
<DIV class=cmt-arearow><STRONG class=required>*</STRONG>昵&nbsp; 称:&nbsp;<INPUT 
id=remarkNickName name=blogRemark.remarkNickName> </DIV>
<DIV class="cmt-arearow areaind">&nbsp;主&nbsp; 页:&nbsp;<INPUT id=remarkEmail 
value=HTTP:// name=blogRemark.remarkHomepage>(选填) </DIV>
<DIV class=cmt-arearow><SPAN class=arearowver><STRONG 
class=required>*</STRONG>内&nbsp; 容:</SPAN> <TEXTAREA class=areartext id=remarkContent onfocus=clearF() name=blogRemark.remarkContent>评论字数限制在200个字符之内</TEXTAREA> 
</DIV>
<DIV class=cmt-arearow><STRONG class=required>*</STRONG>验证码:&nbsp;<INPUT id=rand 
style="MARGIN-BOTTOM: 10px" maxLength=5 name=rand><IMG 
style="MARGIN: 0px 0px 3px 5px" 
src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/rndimg.png" border=0> 
</DIV>
<DIV class=cmt-arearow><SPAN class=lt><STRONG 
class=required>*</STRONG>为必填项</SPAN> <SPAN class="rl ceaaa"><INPUT class=style-btn type=submit value=发布 name=submitRemark></SPAN> 

<DIV class=clear></DIV></DIV></FORM><A id=remark 
name=remark></A></DIV></DIV></DIV>
<DIV class=newly-bot>
<DIV class=newly-bot01></DIV></DIV></DIV></DIV>
<DIV id=rightDiv><!-- 个人形象 -->
<DIV class=operation id=myPhoto>
<H3 class=select>
<P class=newly-title><SPAN class=newly-Img><IMG 
src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/ico_xingxiang.gif"></SPAN>个人形象</P></H3>
<DIV class=col-body>
<DIV class=newly-right>
<DL class=pingl-Dl>
  <DT><IMG id=photoImg height=120 
  onerror="this.src='http://blogteam.bokee.com/pub/images/logo_s.png'" 
  src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/logo_s.png" width=120> 
  <P><A href="javascript:doAddFriend('lucksyw.bokee.com');"><IMG 
  src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/myphoto-addfriend.gif">加为好友</A> 
  <A href="javascript:popPostMsg('lucksyw.bokee.com');"><IMG 
  src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/myphoto-msg.gif">发送私信</A> 
  </P>
  <P><A href="javascript:popNote('lucksyw.bokee.com');"><IMG 
  src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/myphoto-note.gif">给我留言</A> 
  <A href="javascript:addFavorite('','http://lucksyw.bokee.com/');"><IMG 
  src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/myphoto-favo.gif">加入收藏</A> 
  </P>
  <P><A 
  href="http://group.bokee.com/group/userjump.action?userId=12169543&amp;blogId=lucksyw.bokee.com"><IMG 
  src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/myphoto-group.gif">我的群组</A> 
  <A href="javascript:commendblog('lucksyw.bokee.com');"><IMG 
  src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/myphoto-friend.gif">荐给好友</A> 
  </P><!--	<p>
		<a href="#x" onClick='jionChatRoomMyPhoto()'><img src="http://blogteam.bokee.com/pub/images/myphoto-chat.gif" alt="去聊天室" />去聊天室</a>
		
    	<a href="http://mov.bokee.com/" target="_black" ><img src="http://blogteam.bokee.com/pub/images/gomovie.gif">去看电影</a>
     --><!--		
		<a href="#x" onClick="javascript:alert('此功能正在开发中,过段时间就可以使用了!祝愉快^_^!');" style="color: #7F7F7F; "><img src="http://blogteam.bokee.com/pub/images/myphoto-mail.gif">发送邮件</a>
//-->
  <P></P></DT></DL></DIV>
<DIV class=newly-bot>
<DIV class=newly-bot01></DIV></DIV></DIV></DIV>
<DIV class=operation id=rising>
<H3 class=select>
<P class=newly-title><SPAN class=newly-Img><IMG 
src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/ico_16.gif"></SPAN>反病毒中心</P></H3>
<DIV class=col-body>
<DIV class=newly-right>
<DIV class=rx_div>
<DIV class=rx_con>
<TABLE class=linkimg-rx cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD>
      <DIV style="TEXT-ALIGN: center">以下服务由<FONT 
  color=red>瑞星</FONT>友情提供</DIV></TD></TR>
  <TR>
    <TD class=youqingTd><A 
      href="http://bokee.allyes.com/main/adfclick?db=bokee&amp;bid=248,1338,1751&amp;cid=0,0,0&amp;sid=17241&amp;advid=100&amp;camid=275&amp;show=ignore&amp;url=http://ad.doubleclick.net/clk;134682177;20226654;f?http://www.rising.com.cn/2008/trial/index.htm" 
      target=_blank><B>瑞星2008版下载</B><BR>(全面免费)</A></TD></TR>
  <TR>
    <TD class=youqingTd><A 
      href="http://bokee.allyes.com/main/adfclick?db=bokee&amp;bid=248,1340,1753&amp;cid=0,0,0&amp;sid=17243&amp;advid=100&amp;camid=275&amp;show=ignore&amp;url=http://tool.ikaka.com/" 
      target=_blank><B>卡卡助手下载</B><BR>(免费杀流氓软件工具)</A></TD></TR>
  <TR>
    <TD class=youqingTd><A 
      href="http://bokee.allyes.com/main/adfclick?db=bokee&amp;bid=248,1341,1754&amp;cid=0,0,0&amp;sid=17244&amp;advid=100&amp;camid=275&amp;show=ignore&amp;url=http://it.rising.com.cn/Channels/Service/index.shtml" 
      target=_blank><B>专杀工具下载</B><BR>(50余种病毒专杀下载)</A></TD></TR></TBODY></TABLE></DIV></DIV></DIV></DIV>
<DIV class=newly-bot>
<DIV class=newly-bot01></DIV></DIV></DIV>
<DIV class=operation id=blogIndex>
<H3 class=select>
<P class=newly-title><SPAN class=newly-Img><IMG 
src="写出vc动态连接库的方法之一 VC编程 VC编程 lucksyw_bokee_com.files/ico_wodeguanggao.gif"></SPAN>定制广告</P></H3>
<DIV class=col-body>
<DIV class=newly-right><A class=youqingTd 
href="http://alimamainc.bokee.com/viewdiary.19044158.html" 
target=blank><B>阿里妈妈与bokee联手&nbsp;&nbsp;<BR>专业定做属于您自己的广告</B></A> </DIV></DIV>
<DIV class=newly-bot>
<DIV class=newly-bot01></DIV></DIV></DIV><!--更多文章-->
<DIV class=operation id=entry-browse-col>
<H3 class=select>

⌨️ 快捷键说明

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