procedure TForm1.Button1Click(Sender: TObject);
var
setpass:Tsetpass;
getIPs:TgetIPs;
// FPointer:TFarProc;
H:THandle;
begin
H:=LoadLibrary('ERPT1.DLL');
@setpass:=GetProcAddress(H,'setpass');
if not (@setpass=nil) then
edit2.Text:=setpass(edit1.Text);
FreeLibrary(H);
showmessage('abc');
end;
在這段代碼中,edit2得到了我要的結果,showmessage也正確顯示了,但我把message框關閉後就出現一個異常
Access violation at address 0040E58 in module 'Project.exe'.read of address 00F52478.Process stopped.請問高手這到底是怎麼回事,謝謝。
var
setpass:Tsetpass;
getIPs:TgetIPs;
// FPointer:TFarProc;
H:THandle;
begin
H:=LoadLibrary('ERPT1.DLL');
@setpass:=GetProcAddress(H,'setpass');
if not (@setpass=nil) then
edit2.Text:=setpass(edit1.Text);
FreeLibrary(H);
showmessage('abc');
end;
在這段代碼中,edit2得到了我要的結果,showmessage也正確顯示了,但我把message框關閉後就出現一個異常
Access violation at address 0040E58 in module 'Project.exe'.read of address 00F52478.Process stopped.請問高手這到底是怎麼回事,謝謝。
觉得应该这样写的:setpass := GetProcAddress(H,'setpass');
if setpass <> nil then
edit2.Text:=setpass(edit1.Text);
setpass := (Tsetpass)GetProcAddress(H,'setpass');
if setpass <> nil then
edit2.Text:=setpass(edit1.Text);