首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

Delphi 7中访问DLL,报错‘Access Violation at address 00404B50 in moudle'ElisaStar.exe'.

2012-02-13 
Delphi 7中访问DLL,报错‘Access Violation at address 00404B50 in moudleElisaStar.exe.Read of addres

Delphi 7中访问DLL,报错‘Access Violation at address 00404B50 in moudle'ElisaStar.exe'.Read of address 03BE0B08’.
procedure   TMainForm.mmiHelpClick(Sender:   TObject);
Type
    TCommuConnect_ErrorCodes=Function(x:byte):String;stdcall;
var
    Commu_Code:byte;
    Th:THandle;
    Tf:TCommuConnect_ErrorCodes;
    Tp:TFarproc;
begin
          comBioMed   :=CreateOLEObject( 'BioMed.Instruments ');
          Commu_Code   :=comBioMed.SetSetting(USB_Communicate);
try
          Th:=LoadLibrary(PChar( 'ErrorHandling.dll '));
          if   Th> 0   then
                @Tf:=GetProcAddress(Th,PChar( 'CommuConnect_ErrorCodes '));
                if   Assigned(Tf)   then
                      begin
                      Label1.Caption:=Tf(Commu_Code);
                      end;
finally
          FreeLibrary(Th);//单步执行到这是报上述错误
end;
end;
此程序是完成返回一个字符串功能,报‘Access   Vilolation   at   address.....’错误,但字符还能正常返回来显示。


[解决办法]

在DLL中使用String类型:
1、在你的DLL项目源文件中第一个引用ShareMem单元;
2、你必须在你的应用程序项目源文件中第一个引用SHAREMEM单元;

热点排行