The only practical way to do this is to select the line in the Inno setting and pass a pointer to it along with the length in the DLL, which then writes it to the length value before returning.
Here is an example of code taken from a newsgroup .
function GetWindowsDirectoryA(Buffer: AnsiString; Size: Cardinal): Cardinal; external ' GetWindowsDirectoryA@kernel32.dll stdcall'; function GetWindowsDirectoryW(Buffer: String; Size: Cardinal): Cardinal; external ' GetWindowsDirectoryW@kernel32.dll stdcall'; function NextButtonClick(CurPage: Integer): Boolean; var BufferA: AnsiString; BufferW: String; begin SetLength(BufferA, 256); SetLength(BufferA, GetWindowsDirectoryA(BufferA, 256)); MsgBox(BufferA, mbInformation, mb_Ok); SetLength(BufferW, 256); SetLength(BufferW, GetWindowsDirectoryW(BufferW, 256)); MsgBox(BufferW, mbInformation, mb_Ok); end;
Also see this thread for a more up-to-date discussion.
source share