我的一个程序:function ShowCalculator(mainApp:TApplication;calcForm:TForm;var calcValue:real):boolean;stdcall; begin if calcForm=Nil then calcForm:=TfrmCalculator.Create(mainApp); calcForm.ShowModal; calcValue:=calcResult; calcForm:=Nil; Result:=calcTransMode; end; exports ShowCalculator; function ShowCalculator(application:TApplication;calcForm:TForm;var calcTransValue:real):boolean;stdcall;external 'CalculatorDll.Dll'; if ShowCalculator(application,calcForm,calcTransValue) then Face.DisplayFocus^.Text :=FloattoStr(calcTransValue);
我有一个列子这样做的,我作就不行,
再说我去掉handle,能正常运行,
看样子,问题在handle上,
library Mytest
procedure ShowMyForm(handle:THandle;Caption:Pchar);stdcall
var frm:TYourForm;
begin
frm:=TYourForm.Create(handle);
try
frm.Caption:=strPas(Caption);
frm.showmodal;
finally
frm.free;
end;
end;
exports
ShowMyForm;
begin
end;
uses
WF_CARDU in 'WF_CARDU.pas' {WF_CARD},
DmIckDll in 'DmIckDll.pas' {DMICK: TDataModule},
WPREVIEW in 'WPREVIEW.pas' {WPREVIEWF};exports
ICKYYFX;
{$R *.RES}begin
end.
在 WF_CARDU in 'WF_CARDU.pas' {WF_CARD},中:procedure ICKYYFX(APPHAND:THANDLE;BH,PASS,PATH,BC:STRING;BBRQ:TDATE;key:string);
begin
// Application.Handle := AppHAND;//去掉本行,及procdure 中APPHAND反而能行 DMICK:=TDMICK.Create(APPLICATION);
DMICK.DB_ICKDLL.Connected:=true;
WF_CARD :=TWF_CARD.Create(Application);
WF_CARD.ShowModal;
WF_CARD.Free;
end;
begin
if calcForm=Nil then
calcForm:=TfrmCalculator.Create(mainApp);
calcForm.ShowModal;
calcValue:=calcResult;
calcForm:=Nil;
Result:=calcTransMode;
end;
exports ShowCalculator;
function ShowCalculator(application:TApplication;calcForm:TForm;var calcTransValue:real):boolean;stdcall;external 'CalculatorDll.Dll'; if ShowCalculator(application,calcForm,calcTransValue) then
Face.DisplayFocus^.Text :=FloattoStr(calcTransValue);