ASP中如何调用DELPHI生成的DLL啊?(100分)

  • 主题发起人 飞雪轩主
  • 开始时间

飞雪轩主

Unregistered / Unconfirmed
GUEST, unregistred user!
ASP中如何调用DELPHI生成的DLL啊?
用DELPHI生成一个DLL文件,代码如下。这个DLL如何在ASP网页中调用啊?


library Dllserver;

{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }

uses
SysUtils,
Classes;

{$R *.res}

//函数两数相加
function Add(x,y:Integer):Integer;stdcall;
begin
Result := x + y;
end;

//定义输出子句
exports
Add;
begin
end.
 
呵呵,这样可不行.
得先new一个ActiveX Library
再new一个Active Server Object
通过Type library Edit添加一个方法.
再在实现方法的单元里实现加法.

编译好后用regsvr32 your.dll注册.
就可以通过 server.createobject调用了.
呵呵,简单吧.
 
建立一AUTOMATION对象即可!
 
能不能具体点啊,算一个加法题就行
 
呵呵,我说的够详细的了.
你一步一步做肯定能行.
 
我同意LeeChange的做法
 
server.createobject
这部份详细点好吗?我没有ASP的经验
 
<% Set Obj = Server.CreateObject("ProjectName.ObjectName")
Obj.YourMethod(x, y)
%>
 
继续关注
 
这个问题很急呀,哪位能用我上面的DLL例子
给出ASP中的详细代码呀?
 
asp按我说的写就行了.
但你编的dll是不能直接被asp调用的,一定要按我说的方法生成包含asp组件的dll才行.
 
why not try by leeChange's method?
 
1.编写COM组件:
File->New->ActiveX->ActiveX Library,保存;
File->New->ActiveX->Active Server Object 保存.
在类型库中添加属性、方法。

2.注册COM组件:
把DLL组件文件拷到 C:/WINNT/system32 目录下,在命令行中输入:
regsvr32 C:/WINNT/system32/YourComFileName.dll
或者在Delphi中 Run->Register ActiveX Server .

3.在ASP中调用:

<HTML>
<BODY>
<TITLE> Testing Delphi ASP </TITLE>
<CENTER>
<H3> You should see the results of your Delphi Active Server method below </H3>
</CENTER>
<HR>
<%
Set DelphiASPObj = Server.CreateObject("ComForAspDemo.Employee")
DelphiASPObj.{Insert Method name here}
{如:}
Dim iCount = DelphiASPObj.EmployeeCount
Response.write iCount
%>
<HR>
</BODY>
</HTML>

 
顶部