Skip to main content

Problem:

This example demonstrates the use of the Win32 SDK function FormatMessage to receive an error message text associated with a specified error number. Normally this would be used in conjunction with the GetLastError function in order to receive the error message text associated with an error returned by the last Win32 SDK function call. This example will simply display the error message text for the first 20 system errors numbered 0 through 19. This example also demonstrates the use of COBOL typedefs.

Resolution:

INTRODUCTION

==========

This example demonstrates the use of the Win32 SDK function FormatMessage to receive an error message text associated with a specified error number. Normally this would be used in conjunction with the GetLastError function in order to receive the error message text associated with an error returned by the last Win32 SDK function call.

This example will simply display the error message text for the first 20 system errors numbered 0 through 19.

This example also demonstrates the use of COBOL typedefs.

SOURCE FILES:

=========

Program Files         Description

-------------------     -----------------------------------------------------------

GETERROR.CBL     Program that calls the FormatMessage function.

WINTYPES.CPY      Copy file containing the converted Win32 typedefs so they can be used in

                              COBOL.

MINIWIN .CPY       Copy file containing the Win32 API entry point names and environment

                              constants.

WINBASE .CPY      Copy file containing the converted definitions of various Win32 API constants.

REQUIREMENTS:

==========

This sample should run in all environments.

OPERATION:

========

Rebuild this project to create the file geterror.exe. This is a character mode program that will display the text of the first 20 system error messages.

==========================================================

Keywords: demonstration, sample, example, demo, win32 api, geterror.zip

demo.ex

demo.ne

 

 

Attachments

Old KB# 4173