home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / CFGED1B.ZIP / CFGEDSRC.ZIP / PMCTOOL.CC < prev    next >
C/C++ Source or Header  |  1992-07-18  |  3KB  |  81 lines

  1. // this might look like 'C', but it's really  -*-c++-*-
  2. /* pmctool.cc
  3.  *
  4.  * Utility functions for easy PM access
  5.  *
  6.  * Language        : C++
  7.  * Operating System: OS/2 V2.0 and higher
  8.  * Compiler        : GNU GCC V2.1 and higher
  9.  *
  10.  *
  11.  * $Id: pmctool.cc,v 1.2 1992/07/18 01:21:25 gruen Exp $
  12.  * $Log: pmctool.cc,v $
  13. // Revision 1.2  1992/07/18  01:21:25  gruen
  14. // corrected minor bugs and enhanced makefile with clean and install section.
  15. //
  16. // Revision 1.1  1992/07/17  00:23:36  gruen
  17. // Initial revision
  18. //
  19.  *
  20.  * Copyright (c) 1990, 1991, 1992 Lutz Grueneberg
  21.  *
  22.  * This library is free software; you can redistribute it and/or modify
  23.  * it under the terms of the GNU Library General Public License as
  24.  * published by the Free Software Foundation; either version 2 of the
  25.  * License, or (at your option) any later version.  This library is
  26.  * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  27.  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  28.  * A PARTICULAR PURPOSE.  See the GNU Library General Public License for
  29.  * more details. You should have received a copy of the GNU Library
  30.  * General Public License along with this library; if not, write to the
  31.  * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  32.  */
  33. #define INCL_WIN 
  34. #include <os2.h>
  35. #include <stdio.h>
  36. #include <stdarg.h>
  37. #include "pmctool.h"
  38.  
  39. static CHAR szPmToolText[256];
  40.  
  41. /*------------------------------------------------------------*
  42.  * VOID PmUserMessage( HWND hwnd, char *szMessage)
  43.  *------------------------------------------------------------*
  44.  *  Diese Funktion gibt die überreichte Message als
  45.  *  Box aus.                           
  46.  *  Agiert mit den Parametern wie printf über Variable
  47.  *  Argumentenliste
  48.  *------------------------------------------------------------*/
  49. VOID PmUserMessage( HWND hwnd,CHAR *szFormat, ...)
  50. {   
  51.     va_list     ArgPtr;
  52.     
  53.     va_start( ArgPtr, szFormat);
  54.     vsprintf( szPmToolText, szFormat, ArgPtr);    
  55.     WinMessageBox (HWND_DESKTOP, hwnd, (PSZ)szPmToolText,
  56.         (PSZ)"Information:", 0, MB_OK | MB_ICONEXCLAMATION) ;
  57.     va_end( ArgPtr);
  58. }
  59.  
  60. /*------------------------------------------------------------*
  61.  * SHORT PmUserRequest( HWND hwnd, CHAR *szMessage)
  62.  *------------------------------------------------------------*
  63.  *  Diese Funktion gibt die überreichte Message als
  64.  *  Box aus. Dabei wird der Benutzer nach einer Eingabe
  65.  *  befragt. Anwortet er mit ja, kommt ein TRUE zurück,
  66.  *  andernfalls ein FALSE.
  67.  *------------------------------------------------------------*/
  68. SHORT PmUserRequest( HWND hwnd,CHAR *szFormat, ...)
  69. {
  70.     va_list     ArgPtr;
  71.     
  72.     va_start( ArgPtr, szFormat);
  73.     vsprintf( szPmToolText, szFormat, ArgPtr);    
  74.     va_end( ArgPtr);
  75.     if( WinMessageBox (HWND_DESKTOP, hwnd,
  76.                (PSZ)szPmToolText, (PSZ)"Request:", 0, 
  77.                MB_YESNO | MB_ICONQUESTION) == MBID_YES) return TRUE;
  78.     return FALSE;
  79. }
  80. /* E O F */
  81.