delphi2007 教程

delphi2007 教程

首页 新随笔 联系 聚合 管理
  1013 Posts :: 0 Stories :: 28 Comments :: 0 Trackbacks

我的程序是这样的  
  TreturnDbname=function():String;stdcall;  
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  var  
        returnDbname   :   TReturnDbname;  
        AHandle:   THandle;  
  begin  
   
          CoInitialize(nil);  
          AHandle:=LoadLibrary('CreatePro.dll');  
          try  
                if   AHandle<>0   then  
                      @returnDbname:=GetProcAddress(AHandle,'returnDbName');  
                      if   not(@returnDbname=nil)   then  
                      begin  
   
                              dbname:=returnDbname();  
                              showmessage('dbname='+dbname);  
                      end;  
          finally  
                  freeLibrary(AHandle);  
          end;  
  end;  
  我把freeLibrary(AHandle);注释掉程序执行完了关闭窗口时,但是整个project1却没有关闭依然在内存里运行着;而加上freeLibrary(AHandle);在程序运行完毕连showmessage('dbname='+dbname);也执行对了点击showmessage出现的窗口后就出现这样的错误:Access   violation   at   address   00403F7E   in   module   'project1.exe'.Read   of   address   0168B792C.请问这是什么原因啊,该怎么解决,谢谢!

继续阅读《加载dll时出现的问题》的全文内容...



--------------------------
新闻:一款软件何以管理一个复杂的社会
网站导航: 博客园首页  新闻  .NET频道  社区  博问  闪存  找找看
posted on 2009-06-10 13:54 delphi2007 阅读(354) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。