home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mltwin.zip / UFMULTW.C < prev    next >
C/C++ Source or Header  |  1992-10-06  |  2KB  |  45 lines

  1. #define INCL_DOS
  2. #define INCL_PM
  3. #include <os2.h>
  4. #include <gpfparms.h>
  5. #include "MULTWIN.IDS"
  6. #include "MULTWIN.EXT"
  7. #include "MULTWIN.H"
  8.  
  9. void UFCreateMultWindow(PVOID pCrtParms) {
  10.    CreateMultWindow(pCrtParms);
  11. }
  12.  
  13. /************************************************************/
  14. /** User destroying function pair                */
  15. /** Only from another window you can apply WinDestroyWindow */
  16. /** in the Gpf '.exe' world.                    */
  17. /** [This is one of many possible solutions]            */
  18. /************************************************************/
  19.  
  20. #define    WM_USER_DESTROY    (WM_USER+1)
  21.  
  22. /******************************************************************/
  23. /** Function fDestroy is attached to a control within the *********/
  24. /**  window of which many copies are permitted. Use this instead **/
  25. /**  of the GPF Window Dismiss function. Rather than trying to     **/
  26. /**  destroy itself, a window issuing this message is asking some */
  27. /**  other (in our case MainWindow) entity to kill it.         **/
  28. /******************************************************************/
  29. void UFSelfDestruct(PGPFPARMS pGpfParms) {
  30.    WinPostMsg(hwndMainWindow,WM_USER_DESTROY,
  31.           MPFROMHWND(pGpfParms->hwnd),MPFROMP(NULL));
  32. }
  33.  
  34. /********************************************************************/
  35. /** Function UFMultDestroy in this example is hooked to MainWindow  */
  36. /** at UserMessage receiving. The message WM_USER_DESTROY is        */
  37. /** posted to MainWindow by any procedure desiring to delete a copy */
  38. /** of one of the multiple windows created above.            */
  39. /********************************************************************/
  40. void UFMultDestroy(PGPFPARMS pGpfParms) {
  41.    HWND hwnd = HWNDFROMMP(pGpfParms->mp1);
  42.    if(pGpfParms->msg == WM_USER_DESTROY)
  43.       WinDestroyWindow(GpfGetHwndFrame(hwnd));
  44. }
  45.