下面是调用DLL的一段带吗,但总是出现以下的错误:[Error] Unit3.pas(40): Left side cannot be assigned to这是为什么?? (错误的地方我已经标出来了)procedure TForm3.Button1Click(Sender: TObject);
var
LibHandle : THandle;
ShowPerSN : TForm3;
begin
Application.Title := '我也不知道该写什么';
LibHandle := LoadLibrary('testdll.dll');
try
if Libhandle = 0 then
raise EDLLLoadError.Create ('装载失败!');
@ShowPerSN := GetProcAddress(LibHandle,'ShowPerSN');{就是在这里错的}
if not (@ShowPerSn = nil) then
ShowPerSN(Application.Handle,'呼叫窗体')
else
RaiseLastWin32Error;
finally
FreeLibrary(LibHandle)//Unload the Dll end;
end;
var
LibHandle : THandle;
ShowPerSN : TForm3;
begin
Application.Title := '我也不知道该写什么';
LibHandle := LoadLibrary('testdll.dll');
try
if Libhandle = 0 then
raise EDLLLoadError.Create ('装载失败!');
@ShowPerSN := GetProcAddress(LibHandle,'ShowPerSN');{就是在这里错的}
if not (@ShowPerSn = nil) then
ShowPerSN(Application.Handle,'呼叫窗体')
else
RaiseLastWin32Error;
finally
FreeLibrary(LibHandle)//Unload the Dll end;
end;
TShowPerSN = procedure; stdcall;....
var
LibHandle : THandle;
ShowPerSN : TShowPerSN;
begin
....—————————————————————————————————
宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
—————————————————————————————————
你想干什么?
看我的就没问题
var
pCL1801Dll : THandle; //load--DLL
//打开端口
OpenCommPort: function(port:integer;interval:integer=30;boud:integer=9600):integer;stdcall;implementationfunction LoadCL1801Dll() : Boolean;
begin
pCL1801Dll := LoadLibrary( pchar('CL1800Pro.dll') );
try
if pCL1801Dll <> Null then
begin
OpenCommPort := GetProcAddress(pCL1801Dll,'OpenCommPort');
result := True;
end
else
result := False;
finally
// FreeLibrary(pCL1801Dll);
end;
end;