J
juemimima11
Unregistered / Unconfirmed
GUEST, unregistred user!
dll内的函数,进程调用正常,函数调用则使程序关闭!请问为什么?谢谢///////////////////////////////////////////////以下代码编译生成正常,windows环境下Button1Click结果正常implementationfunction OCR(imgname:string;i:integer)Char;stdcall;external 'AspriseOCR.dll';{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);var PChar_Validation_codechar; string_save_Validation_code:string;begin try string_save_Validation_code:='Validation_code.bmp'; PChar_Validation_code:=OCR(string_save_Validation_code,-1); edit1.text:=strpas(PChar_Validation_code); except end;end;///////////////////////////////////////////////以下代码编译生成正常,windows环境下Button1Click则使程序直接关闭,请问什么原因implementationfunction OCR(imgname:string;i:integer)Char;stdcall;external 'AspriseOCR.dll';{$R *.dfm}function TForm1.Validation_code(string_save_Validation_code:string):string;var PChar_Validation_codechar;begin try PChar_Validation_code:=OCR(string_save_Validation_code,-1); result:=strpas(PChar_Validation_code); except result:='失败' end;end;procedure TForm1.Button1Click(Sender: TObject);begin try edit1.text:=Validation_code('Validation_code.bmp'); except end;end;