var LibHandle : THandle;try
LibHandle := LoadLibrary('RegDll.dll');
if LibHandle <> 0 then
QryClient.FieldByName('sCode').AsString := SwichPY(edtName.Text)
finally
FreeLibrary(LibHandle);
end;// 注:第一次调用正常,以后报错,错误提示如下
---------------------------
Debugger Exception Notification
---------------------------
Project Book.exe raised exception class EAccessViolation with message 'Access violation at address 002B1DC4 in module 'RegDLL.dll'. Write of address 00000026'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
LibHandle := LoadLibrary('RegDll.dll');
if LibHandle <> 0 then
QryClient.FieldByName('sCode').AsString := SwichPY(edtName.Text)
finally
FreeLibrary(LibHandle);
end;// 注:第一次调用正常,以后报错,错误提示如下
---------------------------
Debugger Exception Notification
---------------------------
Project Book.exe raised exception class EAccessViolation with message 'Access violation at address 002B1DC4 in module 'RegDLL.dll'. Write of address 00000026'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
var
MyFunc: Procedure(AHandle: THandle);stdcall;
libh:THandle;
begin
libh:=loadlibrary(pchar(s_dll));
if libh>0 then
begin
try
@MyFunc:=getprocaddress(libh,pchar(s_dllproc));
If @MyFunc <> nil then
MyFunc(Application.Handle)
else
showmessage('CallDllFailed:调用失败.找不到'+s_dllproc+'接口函数.');
finally
freelibrary(libh);
end;
end
else
showmessage('CallDllFailed:调用失败.找不到'+s_dllproc+'接口函数.');
end;如何调用这个过程应该不用说了吧