DllFunction.NextArgPairIsAnsiString

Prototypes

void NextArgPairIsAnsiString( int nMaxLenBuffer, StringBuffer sb )

void NextArgPairIsAnsiString( StringBuffer sb, int nMaxLenBuffer )

Parameters

int nMaxLenBuffer
The maximum number of bytes the DLL function may copy to the buffer.

StringBuffer sb
On entry, contains the Unicode character string to be converted to a null-terminated ANSI character string and then copied to the read-write buffer passed to the DLL function. On return, contains the Unicode character string constructed from the null-terminated ANSI character string copied to the read-write buffer by the DLL function.

Remarks

This method declares the function's next two parameters to be an integer buffer length and a read-write buffer containing a null-terminated ANSI character string. The C language types of these parameters must be either "int, char*" (or equivalent) or "char*, int" (or equivalent). Call the method with the parameters listed in the order required by the DLL function.

The method constructs a null-terminated ANSI character string from the StringBuffer parameter. The DLL function may modify the ANSI character string passed to it as long as the length of the modified string does not exceed nMaxLenBuffer characters in length (including the final null character).

Example
declare DllFunction func = new DllFunction();
func.Init( "kernel32.dll", "GetCurrentDirectoryA", 2 );
declare StringBuffer sb = new StringBuffer();
func.NextArgPairIsAnsiString( 260, sb );
func.Call_Void();
declare String s = sb.toString();
print s;
See Also

DllFunction.NextArgPairIsUnicodeString
DllFunction.NextArgIsConstAnsiString