project BLF > class Win32Lib > method GetLastErrorStr

function returns character

Description

Get the last error produced by a Win32 method.


Internal usage


BLF
method TDaemonUtility.StartDaemonInternal


program code (program1/win32lib.p)

RUN GetLastError (OUTPUT viErrorID).

set-size(vmMess) = 300.

&message UTF-8: use 'FormatMessageW' & convert string from WCHAR  
RUN FormatMessageA (INPUT 512 + 4096,
                    INPUT 0,
                    INPUT viErrorID,
                    INPUT 0,
                    OUTPUT vmMess,
                    INPUT 300,
                    INPUT 0,
                    OUTPUT viTxtLength).
vcTxt = get-string(vmMess,1).
set-size(vmMess) = 0.
return vcTxt.