| type
  cnMessageIDs =
    (
      nMsgID_NoError,
      nMsgID_FileNotFound,
      nMsgID_OutOfMemory,
      nMsgID_ExitProgram
      // list your other error
      // IDs here...
    );
const
  csMessages_ShortVersion
    : array [ Low( cnMessageIDs )..
              High( cnMessageIDs ) ]
      of PChar =
    (
      'No error',
      'File not found',
      'Out of memory',
      'Exit program?'
      // other error messages...
    );
  csMessages_DetailedVersion
    : array [ Low( cnMessageIDs )..
              High( cnMessageIDs ) ]
      of PChar =
    (
      'No error; please ignore!',
      'File c:\config.sys not found.'+
      'Contact your sys. admin.',
      'Out of memory. You need '+
      'at least 4M for this function',
      'Exit program? '+
      'Save your data first!'
      // other error messages...
    );
procedure MsgDisplay(
  cnMessageID : cnMessageIDs );
begin
  // set this to False to display
  // short version of the messages
  if( True )then
    Application.MessageBox(
      csMessages_DetailedVersion[
        cnMessageID ],
      'Error',
      mb_OK )
  else
    Application.MessageBox(
      csMessages_ShortVersion[
        cnMessageID ],
      'Error',
      mb_OK );
end; |