我想用 Delphi 编写包含函数的 Dll,然后在 Excel VBA 调用。试了很多次都无法返回正确的结果。
具体如下:
Delphi7 中的测试源码:
//********************************************************************************************
library XlsExt;
{比较两数的大小,并返回较大者}
uses
SysUtils,
Classes;
{$R *.res}
var
SaveExit:Pointer;
procedure LibExit; //为了不使退出Excel时出现异常
begin
ExitProc:=SaveExit; //恢复退出过程链表
end;
function MyMax(X,Y:SmallInt):SmallInt;stdcall; //定义函数
begin
try
if X>Y then MyMax:=X else MyMax:=Y;
except
MyMax:=333; //测试异常处理,可是好像没有看到这个结果。
end;
end;
exports //函数输出
MyMax;
begin
SaveExit:=ExitProc; //保存退出过程链表
ExitProc:=@LibExit; //设置LibExit为退出过程
我想将c#写的控件嵌到Delphi7的Form中显示,但是始终是没坐成,我通过导入tlb文件,可以通过c#写的接口,实现在Delphi中显示一个窗体,但是显示的只是在桌面上浮动的窗体,无法将他的父容器指定为Delphi的Form,我想 ......
project project3.exe raised exception class ERemotableException with message 'access violation at address 004037B in module'project2.exe'.read of address 00000003'.process stopped.use ......