这样:
FUNC(P1:INTEGER。VAR PN:PCHAR):BOOLEAN;STDCALL;
FUNC(P1:INTEGER。VAR PN:PCHAR):BOOLEAN;STDCALL;
解决方案 »
- 两个问题(1.查询问题2.acess数据求和问题3.刷新问题)
- Delphi2009 编译的程序界面为什么经常变为了Delphi7的界面效果?
- RichEdit.LoadFromFile打开的文件显示乱码问题。
- D6和D7中combobox的区别?
- 请求帮忙噢,有什么办法实现异地两个数据库同步?
- Delphi7+MS SQL Server 客户端是否必须安装MS SQL Server客户端?
- 如何制作类似windows media player 最小化后可以出现在工具栏上(具有控制按钮的那种),不是出现在任务栏上的图标。[
- 一个很急的问题,请大家帮忙丫!
- 一个线程的同步问题!…
- 用这个程序2个小时就可以给出300分,送出源代码,请到sunyuzhe.363.net下载
- 好心人帮帮忙,我确实没分了,sql多条件查询的问题。
- 急!各位说说您们在用ADO操作明细数据表的增加、保存、删除是如何做的呀?我研究好几天了,还是没能解决?
library Project3;{ 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,
Unit2 in 'Unit2.pas' {Form1};{$R *.res}
exports
showform,
closeform;
// DoTest;
beginend.
unit Unit2;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;type
TForm2 = class(TForm)
ADOConnection1: TADOConnection;
Memo1: TMemo;
private
{ Private declarations }
public
{ Public declarations }
end;procedure DoTest(H: THandle; { 获得调用者的句柄 }
AConn: TADOConnection; { 获得调用者的数据库连接 }
S: string; { 获得一些文本信息 }
N: Integer); { 获得一些数值信息 }
cdecl; { 指定调用协议 }
function showform(Ahandle: Thandle; Acaption: string): longint; stdcall;procedure closeform(Aformref: longint); stdcall;implementation{$R *.DFM}procedure DoTest(H: THandle; AConn: TADOConnection; S: string; N: Integer);
begin
Application.Handle := H; { 将过程的句柄赋值为调用者的句柄 }
{ 上面语句的作用在于, DLL的句柄和调用者的句柄相同,在任务栏中就不会 }
{ 各自出现一个任务标题了。 }
with TForm2.Create(Application) do
try { 创建窗体 }
Memo1.Lines.Append('成功调用'); { 显示一行信息 }
ADOConnection1 := AConn; { 获得数据库连接的实例 }
Memo1.Lines.Append(
ADOConnection1.ConnectionString +
' - ' + S + ' - ' + IntToStr(N)); { 根据得到的参数显示另一行信息 }
ShowModal; { 模式化显示窗体 }
finally
Free; { 调用结束时销毁窗口 }
end;
end;function showform(AHandle: THandle; Acaption: string): longint;
var
form2: Tform2;
begin
showmessage('0');
Application.Handle := AHandle;
showmessage('1');
form2 := Tform2.Create(application);
showmessage('2');
result := longint(form2);
showmessage('3');
form2.Caption := Acaption;
form2.Show;end;procedure closeform(Aformref: longint);
begin
if Aformref > 0 then
Tform2(Aformref).Free;
end;
end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
ADOConnection1: TADOConnection;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure DoTest(H: THandle; { 传递句柄 }
AConn: TADOConnection; { 传递数据库连接 }
S: string; { 传递文本信息 }
N: Integer); { 传递数值信息 }
cdecl; { 指定调用协议 }
external 'Project2.dll'; { 指定过程来源 }{ 调用过程 }procedure TForm1.Button1Click(Sender: TObject);
begin
DoTest(Application.Handle,
ADOConnection1,
'Call OK',
256);
end;end.