| 发表于:2007-11-05 11:49:31 楼主 |
我做了一个dll里面只发布一个涵数; //************************ 在dll中是这样定义的(里面封装了窗体): ................... library project1; uses unit1 in 'unit1.pas'; exports dddd; begin end. //涵数定义如下 function ddd( filename:pchar;field_index:integer):pchar; var input_form:tinput_code_form; begin input_form:=tinput_code_form.createform(filename,field_index); with input_form do begin if showmodal = mrok then result:=pchar(input_form.label1.caption) else result:=''; end; end; //*********************************************** 我用程序调用; ....... implementation function dddd(filename:pchar;field_index:integer):pchar;stdcall;external'project1.dll';//功能是返回一个人的姓名; {$r *.dfm} procedure tform1.edit1keydown(sender: tobject; var key: word; shift: tshiftstate); begin if key=vk_f9 then showmessage(dddd(pchar('c:\sy\person_id.ctd'),0)); end; 程序能够正常运行; 但是会出现一个奇怪的现象; 当返回的姓名是三个字的是侯就回出现如:原来是"杨伧林"会显示为 "杨伧 ",好象是被截断了半个字符,但是有时侯又能正常显示"杨伧林" 真不知道是什么原因?请给解释一下? |
|
|
|
|