wtsLastErrMsg

Returns an error message string.

Syntax:

wtsLastErrMsg(error_code)

Parameters:

(i) error_code = error code to lookup

Returns:

(s) error message text associated associated with error_code

 

When performing strict error handling in your code you may want to obtain a text string associated with an error code returned by the Windows Terminal Server Extender. Use the LastError() function in combination with ErrorMode(@OFF) and ErrorMode(@CANCEL) to trap errors that might occur when calling any of the wts*() functions. Then use wtsLastErrMsg() to retrieve the text message associated with the error code obtained via LastError().

Example:
;Load 32-bit or 64-bit extender
AddExtender( "WWWTS44I.DLL" , 0, "WWWTS64I.DLL" )

Title01 = 'Test wtsLastErrMsg()' ErrorMode(@OFF) wtsVersion(-1) ResultCode = LastError() ErrorMode(@CANCEL) ErrMsgText = wtsLastErrMsg(ResultCode) TempMsg = StrCat('wtsVersion() failed, RC = ',ResultCode,@CRLF) TempMsg = StrCat(TempMsg,@CRLF,'Error Message text = "',ErrMsgText,'"') Message(Title01,TempMsg) Exit