请求思路,一个DELPHI程序要调用DLL,而DLL中的函数名,参数个数,参数类型为不定,要调用的DLL中的函数名、参数个数、参数类型要可以在窗口中Edit中动

这两个函数太简单了,<br>一个是利用空格将字符串分成字符串数组<br>另一个是删除字符串两端的双引号
 
[red]TO Lich,现在能运行了,<br>但是,如:<br>function abcd(a1:pchar;var a2:pchar;var a3:integer):short; stdcall;<br><br>如何取得 a2,a3 的返回值?[/red]
 
谢谢lich,我返回PChar类型写错了 应该用 StrPcopy ,给你分了,向你学习
 
function SplitWithSpace(const S: String; QuoteChar: Char): TWords;<br>var<br>&nbsp; i, m, n: Integer;<br>&nbsp; Len: Integer;<br>&nbsp; ct: Integer;<br>&nbsp; InQuote: Boolean;<br>begin<br>&nbsp; Len := Length(S);<br>&nbsp; i := 1;<br>&nbsp; ct := 0;<br>&nbsp; InQuote := False;<br>&nbsp; while i &lt;= Len do<br>&nbsp; begin<br>&nbsp; &nbsp; //跳过一到多个空格<br>&nbsp; &nbsp; while (i &lt;= Len) and (S = ' ') do i := i + 1;<br>&nbsp; &nbsp; m := i;<br>&nbsp; &nbsp; while (i &lt;= Len) and ((S &lt;&gt; ' ') or InQuote) do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; if S = QuoteChar then<br>&nbsp; &nbsp; &nbsp; &nbsp; InQuote := not InQuote;<br>&nbsp; &nbsp; &nbsp; i := i + 1;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; n := i;<br>&nbsp; &nbsp; if n &gt; m then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; SetLength(Result, ((ct + 10) div 10) * 10);<br>&nbsp; &nbsp; &nbsp; Result[ct] := Copy(S, m, n - m);<br>&nbsp; &nbsp; &nbsp; ct := ct + 1;<br>&nbsp; &nbsp; end;<br>&nbsp; end;<br>&nbsp; SetLength(Result, ct);<br>end;<br><br>function UnQuoteString(const S: String): String;<br>var<br>&nbsp; m, n: Integer;<br>begin<br>&nbsp; if Length(s) = 0 then Exit;<br>&nbsp; m := 1;<br>&nbsp; if S[1] = '"' then m := 2;<br>&nbsp; n := Length(S);<br>&nbsp; if S[n] = '"' then n := n - 1;<br>&nbsp; Result := Copy(S, m, n - m + 1);<br>end;
 
顶部