CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
花落谁家,你作主! 盛大widget设计大赛英雄榜
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Delphi >  VCL组件开发及应用

在运行时刻定义DLL中的Function并使用。

楼主gselec(海宏)2002-04-17 18:06:13 在 Delphi / VCL组件开发及应用 提问

我将一个包含DLL的Resource文件包含进了Exe文件。  
  想在执行时导出,然后使用。试验后不行。  
   
  提示找不到DLL,严重错误后退出了。  
   
  到Borland新闻组去问,没有回复。  
   
  各位高见?  
   
   
  Declard   a   function   of   a   DLL   at   RUNTIME.  
   
  How   to   Declard   a   function   in   the   RESOURCE   {$R}.Declard   a   RunTime   Function.  
   
  I   include   a   myrs.res   file   with   a   DLL   in   my   execute   program.  
  First:The   Program   extract   DLL   file   to   Windows   directory.  
  Second:Declare   the   function   in   the   Click   Event   Procedure   of   a   Button.  
  .......using   the   function.  
   
  Can   I   Do   That?  
   
  RunTime   Declare.  
  问题点数:20、回复次数:3Top

1 楼Liusp(夜深千帐灯)回复于 2002-04-17 18:14:37 得分 0

我也希望有解决的办法,但我估计这种方法存在的可能性不大Top

2 楼cplusc(5i海洋)回复于 2002-04-17 21:46:28 得分 0

upTop

3 楼nne998(☆☆☆☆☆☆☆伴月)回复于 2002-04-17 21:56:00 得分 20

显式例子:  
  procedure   TForm1.Button1Click(Sender:   TObject);  
  var   D:   Double;  
          DLLHandle:   THandle;  
          Func:   TGetDouble;  
  begin  
      Image1.Picture.Assign(Table1Graphic);  
      Table1Graphic.Assign(Image1.Picture);  
      Exit;  
      DLLHandle   :=   LoadLibrary('DLLOne.dll');  
      try  
      @Func   :=   GetProcAddress(DLLHandle,   'GetDouble');  
   
      //Edit1.Text   :=   IntToStr(GetInteger(2));  
      //D   :=   GetDouble(2.2);  
      if   Assigned(@Func)   then  
      begin  
          D   :=   Func(2.2);  
          Edit2.Text   :=   FloatToStr(D);  
      end;  
   
      finally  
      FreeLibrary(DLLHandle);  
      end;  
  end;  
   
  end.  
   
  隐式例子:  
   
  library   DLLOne;  
   
  uses  
      SysUtils,  
      Classes;  
   
  {$R   *.res}  
   
      function   GetDoubleExt(F:Double):   Double;stdcall;external   'DLLTwo.dll';  
      function   GetInt(I:Integer):   Integer;stdcall;external   'DLLTwo.dll';  
   
      function   GetInteger(I:Integer):   Integer;stdcall;  
      begin  
          Result   :=   GetInt(I);  
      end;  
   
      function   GetDouble(D:Double):   Double;stdcall;  
      begin  
          Result   :=   GetDoubleExt(D);  
      end;  
   
  exports  
      GetInteger,  
      GetDouble;  
   
  begin  
  end.  
  Top

相关问题

  • 如何让一个c#做的dll文件在自定义的◎AppDomain◎中运行????
  • dll运行出错
  • 有什么工具可以显示DLL内的function 及其定义
  • fastreport 运行时如何自定义列??
  • delphi定义dll调用
  • .dll中函数的定义?
  • C# Dll 运行库 初学
  • 自定义消息如何传入DLL?
  • 急!!!!!!!!!!!如何定义dll的声明!!!!!!!!!!
  • 请教在运行时自定义MSCHART的设置?

关键词

  • runtime
  • dll
  • dllhandle
  • declard
  • getdouble
  • stdcall
  • func
  • assigned
  • double
  • integer

得分解答快速导航

  • 帖主:gselec
  • nne998

相关链接

  • Delphi类图书
  • Delphi类源码下载
  • Delphi控件下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo