home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / Chip_2002-02_cd1.bin / sharewar / apaths / APSOURCE.ZIP / Messages.c < prev    next >
C/C++ Source or Header  |  2001-03-26  |  2KB  |  69 lines

  1. /* Messages - March 26th, 2001
  2. **
  3. **      Copyright (c) 1997-2001 by Gregory Braun. All rights reserved.
  4. **
  5. **      This function opens and displays an MS Windows 95/NT
  6. **      message dialog box containing the text string passed.
  7. **
  8. **      Called:     w         = window handle to the parent.
  9. **                  caption   = a pointer the the window caption, or
  10. **                              NULL to use the application default.
  11. **                  message   = a pointer to the message to be displayed.
  12. **
  13. **      Returns:    TRUE upon success, or FALSE if an error exists,
  14. **                  or the user pressed the [No] or [Cancel] key.
  15. */
  16.  
  17. #include "AppPaths.h"
  18.  
  19. extern BOOL far Message (HWND w,LPCSTR caption,LPCSTR message)
  20. {
  21.     auto DWORD  style = MB_OK | MB_ICONWARNING;
  22.  
  23.     MessageBox (w,message,(caption) ? caption : APP_CAPTION,style);
  24.  
  25.     return (FALSE);
  26. }
  27.  
  28. extern BOOL far Error (HWND w,LPCSTR caption,LPCSTR message)
  29. {
  30.     auto DWORD  style   = MB_OK | MB_ICONWARNING;
  31.     auto DWORD  err     = GetLastError ();
  32.  
  33.     auto int    len;
  34.     auto char   buffer[MSTRING];
  35.  
  36.     *buffer = EOS;
  37.  
  38.     lstrcpy (buffer,message);
  39.  
  40.     if (err) {
  41.         lstrcat (buffer,"\r\r");
  42.         len = lstrlen (buffer);
  43.         SysError (err,&buffer[len]);
  44.         }
  45.  
  46.     MessageBox (w,buffer,(caption) ? caption : APP_CAPTION,style);
  47.  
  48.     return (FALSE);
  49. }
  50.  
  51. extern BOOL far Query (HWND w,LPCSTR caption,LPCSTR message)
  52. {
  53.     auto DWORD  style = MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2;
  54.  
  55.     if (MessageBox (w,message,(caption) ? caption : APP_CAPTION,style) == IDYES)
  56.         return (TRUE);
  57.  
  58.     return (FALSE);
  59. }
  60.  
  61. extern BOOL far Beeper (void)
  62. {
  63.     MessageBeep (MB_OK);
  64.  
  65.     return (FALSE);
  66. }
  67.  
  68. /* end of Messages.c - written by Gregory Braun */
  69.