各位高手请问怎样把一个窗体做为参数来传递呀我做了一个初始化窗体控件的DLL,代码如下:
library Wzz_ResetForm;{ 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
ExtCtrls,
QStdCtrls,
Forms,
SysUtils,
Classes;
procedure ResetForm(FormName:pointer);stdcall;
var
i:integer;
begin
for i:=0 to TForm(FormName).ComponentCount - 1 do
begin
if TForm(FormName).Components[i] is TLabeledEdit then
TLabeledEdit(TForm(FormName).Components[i]).Text:='';
if TForm(FormName).Components[i] is TCheckbox then
TCheckbox(TForm(FormName).Components[i]).Checked:=false;
end;
end;
{$R *.res}begin
end.
请问我在应用程序中调用该DLL时怎样来传递窗体呀
现在我传递了一个指针,可是应用程序编译不了呀
怎样解决呀?
library Wzz_ResetForm;{ 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
ExtCtrls,
QStdCtrls,
Forms,
SysUtils,
Classes;
procedure ResetForm(FormName:pointer);stdcall;
var
i:integer;
begin
for i:=0 to TForm(FormName).ComponentCount - 1 do
begin
if TForm(FormName).Components[i] is TLabeledEdit then
TLabeledEdit(TForm(FormName).Components[i]).Text:='';
if TForm(FormName).Components[i] is TCheckbox then
TCheckbox(TForm(FormName).Components[i]).Checked:=false;
end;
end;
{$R *.res}begin
end.
请问我在应用程序中调用该DLL时怎样来传递窗体呀
现在我传递了一个指针,可是应用程序编译不了呀
怎样解决呀?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货