home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 036 / emxfix02.zip / emx / src / os2 / pm.c < prev    next >
C/C++ Source or Header  |  1994-12-21  |  2KB  |  72 lines

  1. /* pm.c -- Presentation Manager stuff
  2.    Copyright (c) 1994 by Eberhard Mattes
  3.  
  4. This file is part of emx.
  5.  
  6. emx is free software; you can redistribute it and/or modify it
  7. under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. emx is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with emx; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. As special exception, emx.dll can be distributed without source code
  21. unless it has been changed.  If you modify emx.dll, this exception
  22. no longer applies and you must remove this paragraph from all source
  23. files for emx.dll.  */
  24.  
  25.  
  26. #define INCL_DOSMODULEMGR
  27. #define INCL_WINWINDOWMGR
  28. #include <os2emx.h>
  29. #include "emxdll.h"
  30.  
  31.  
  32. static HAB (*p_WinInitialize) (ULONG fsOptions);
  33. static HMQ (*p_WinCreateMsgQueue) (HAB hab, LONG cmsg);
  34. static ULONG (*p_WinMessageBox) (HWND hwndParent, HWND hwndOwner, PCSZ pszText,
  35.     PCSZ pszCaption, ULONG idWindow, ULONG flStyle);
  36.  
  37.  
  38. #define LOAD_PMWIN(ord,var) \
  39.     (DosQueryProcAddr (hmod_pmwin, ord, NULL, (PPFN)var) != 0)
  40.  
  41. int pm_init (void)
  42. {
  43.   HAB hab;
  44.   HMQ hmq;
  45.   HMODULE hmod_pmwin;
  46.   char obj[9];
  47.  
  48.   if (DosLoadModule (obj, sizeof (obj), "PMWIN", &hmod_pmwin) != 0)
  49.     return (FALSE);
  50.  
  51.   if (LOAD_PMWIN (763, &p_WinInitialize)
  52.       || LOAD_PMWIN (716, &p_WinCreateMsgQueue)
  53.       || LOAD_PMWIN (789, &p_WinMessageBox))
  54.     {
  55.       DosFreeModule (hmod_pmwin);
  56.       return (FALSE);
  57.     }
  58.  
  59.   hab = p_WinInitialize (0);
  60.   if (hab == NULLHANDLE) return (FALSE);
  61.   hmq = p_WinCreateMsgQueue (hab, 0);
  62.   return (hmq != NULLHANDLE);
  63. }
  64.  
  65.  
  66. void pm_message_box (PCSZ text)
  67. {
  68.   if (p_WinMessageBox != NULL)
  69.     p_WinMessageBox (HWND_DESKTOP, HWND_DESKTOP, text, "emx.dll", 0,
  70.                      MB_MOVEABLE | MB_OK | MB_ICONHAND);
  71. }
  72.