FormatMessage
|
| Feedback |
Syntax
FormatMessage ( nErrorReturnCode );
Description
FormatMessage provides the error message text associated with a large error code—for example, -2147024891 (0x80070005)—that was returned by a built-in InstallScript function.
Parameters
nErrorReturnCode
Pass a large error code—for example, -2147024891 (0x80070005)—that was returned by a built-in InstallScript function. Passing the error code -1 will not produce useful results.
Return values
A string containing the error message text associated with the error code nErrorReturnCode.
Example
Following is a script fragment that demonstrates the use of FormatMessage:
nResult = CreateDir ( szDirPath );
if nResult < 0 then
if nResult = -1 then
MessageBox ( "CreateDir failed with error code -1!", WARNING );
else
svErrorMessage = FormatMessage ( nResult );
SprintfBox ( WARNING, "",
"CreateDir failed!\n\nError code: %ld\nMessage text: %s",
nResult, svErrorMessage );
endif;
endif;