你可以用wvsprintf<br>function AllocMem(Size: Cardinal): Pointer;<br>begin<br> GetMem(Result, Size);<br> FillChar(Result^, Size, 0);<br>end;<br>procedure Ex;<br>var<br> Buf: pChar;<br> va_list: array [0..1] of longint;<br> Str: String;<br>begin<br> Str:= 'Delphi';<br> va_list[0] := longint( Pchar(Str));<br> va_list[1] := 1234;<br> Buf := allocMem(10);<br> wvsprintf(Buf, 'Str: %s, v: %i', @va_list );<br> MessageBox(0, Buf, 'Example', mb_OK);<br> FreeMem(Buf, 20);<br>end;<br>//---------------------------------------------------------------<br>也可以试试用这个:(别人写的)<br>function _wsprintf(lpOut: PChar; lpFmt: PChar; lpVars: Array of Const):<br>Integer; assembler;<br>var<br> Count: integer;<br> v1, v2: integer;<br>asm<br> mov v1, eax<br> mov v2, edx<br> mov eax, ecx { data pointer }<br> mov ecx, [ebp+$08] { count }<br> inc ecx<br> mov Count, ecx<br> { Make ebx point to last entry in lpVars }<br> dec ecx<br> imul ecx, 8<br> add eax, ecx<br> mov ecx, Count<br>@@1:<br> mov edx, [eax]<br> push edx<br> sub eax, 8<br> loop @@1<br><br> push v2<br> push v1<br><br> call wsprintf<br><br> { clean up stack }<br> mov ecx, Count<br> imul ecx, 4<br> add ecx, 8<br> add esp, ecx<br>end;<br>procedure Ex2;<br>var<br> A: Array[0..512] of char;<br>begin<br> _wsprintf(A, '%d %c%c%c%c%c%c %s ', [1234, 68, 69,76,80,72,73, 'Delphi']);<br> MessageBox(0,A,'hi',MB_OK);<br>end;<br>//-------------------------<br>在这儿找找 <br>http://groups.google.com/groups?q=delphi+wsprintf&ie=UTF-8&oe=UTF-8&hl=en<br>//-------------------------<br>CIONO1