易截截图软件、单文件、免安装、纯绿色、仅160KB

Excel 如何调用 Delphi 编译的 Dll 中的函数?

我想用 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为退出过程


相关问答:

Python中的Unicode在Delphi如何还原成Gb2312?

已知Python 中:
s = unicode("测试", "gb2312")
s = u'\u6d4b\u8bd5'
print s
测试

在Delphi里面如何将\u6d4b\u8bd5这样的还原成Gb2312的汉字呢?
找到个方法
......

delphi+access 图片显示、替换问题

问问各位高手,1.ACCESS数据库能够存储图片格式的内容吗(JPEG BMP),如果可以应该用什么格式
              2.为了正确显示数据库中的图片delphi中应用到那些控件
  ......

转帖:DELPHI编写服务程序总结二--编写技巧

原文地址:http://hi.baidu.com/sqldebug/blog/item/58a764624a44d74eeaf8f863.html

一、如何限制系统服务和桌面程序只运行一个

如何限制系统服务和桌面程序只运行一个

在工程加入下列代码可以 ......

delphi 与 C# 位运算 有好大区别,请教各位!

delphi 函数:

function RB(A: longint): longint;
begin
  Result := (A shr 24) or ((A shr 8) and $FF00) or ((A shl 8) and $FF0000) or (A shl 24);
end;


我转成C#:

& ......

delphi webservice 调用报错 急

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 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号