vb代码如下:请用DEPHI 实现
Option Explicit
Private Declare Function VCGetDoc Lib "vcwfs.dll" (ByVal intNumber As Integer, ByVal strData As String) As Long
Private Sub Command1_Click()
Dim strTextAll As String * 50000strTextAll = " "
VCGetDoc 10, strTextAll
End Sub
注意:在vb中strTextAll 必须申明为50000,或者更大,因为strTextAll返回一个50000左右的字符串.若只定义dim strTextAll as String 将不能返回字符串,只能返回空字符串.
Option Explicit
Private Declare Function VCGetDoc Lib "vcwfs.dll" (ByVal intNumber As Integer, ByVal strData As String) As Long
Private Sub Command1_Click()
Dim strTextAll As String * 50000strTextAll = " "
VCGetDoc 10, strTextAll
End Sub
注意:在vb中strTextAll 必须申明为50000,或者更大,因为strTextAll返回一个50000左右的字符串.若只定义dim strTextAll as String 将不能返回字符串,只能返回空字符串.
external 'vcwfs.dll' name 'VCGetDoc';procedure Cmmand1_click;
var
strTextAll:string;
begin
strText:='';
SetLength(strTextAll,50000);
VcGetDoc(10,pchar(strTextAll));
end;
这句编译错误:constant object cannot passed as var parameter.
external 'vcwfs.dll' name 'VCGetDoc';procedure Cmmand1_click;
var
strTextAll:string;
intNum: Integer;
begin
strTextAll:='';
SetLength(strTextAll,50000);
intNum := 10;
VcGetDoc(intNum,strTextAll);
end;
external 'vcwfs.dll' name 'VCGetDoc';
procedure Cmmand1_click;
var
strTextAll:string;
I : integer;
begin
strText:='';
I := 10;
SetLength(strTextAll,50000);
VcGetDoc(I,pchar(strTextAll));
end;
strTextAll:WideString;
I : integer;
begin
VcGetDoc(10,pchar(strTextAll));
end;
一滴蜜糖的解答同样和liufuyahong一样的编译错误
function VCGetDoc(intNum:Integer;strData):LongInt;stdcall;
external 'vcwfs.dll' ;
procedure Cmmand1_click;
var
strTextAll:string;
K:integer;
begin
strText:='';
k:=10;
SetLength(strTextAll,50000);
VcGetDoc(k,pchar(strTextAll));
end;
external 'vcwfs.dll' ;
procedure Cmmand1_click;
var
strTextAll:pchar;
K:integer;
begin
strText:='';
k:=10;
SetLength(strTextAll,50000);
VcGetDoc(k,strTextAll);
end;
SetLength(strTextAll,50000);处出现编译错误:
constant object cannot passed as var parameter
external 'vcwfs.dll' ;
procedure Cmmand1_click;
var
strTextAll:pchar;
a:string;
K:integer;
begin
strText:='';
k:=10;
SetLength(a,50000);
strTextAll:=pchar(a);
VcGetDoc(k,strTextAll);
end;
我研究了一个星期。但小于代码还是有个小错误,a:string还是提不出来,改成a:widestring.才能提出字符串。可能与提出的字符串中有中文有关系。散分!