home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / NBSIZE.ZIP / MLE.C < prev    next >
Text File  |  1993-01-03  |  7KB  |  135 lines

  1. /*********************************************************************
  2.  *                                                                   *
  3.  * MODULE NAME :  mle.c                  AUTHOR:  Rick Fishman       *
  4.  * DATE WRITTEN:  11-28-92                                           *
  5.  *                                                                   *
  6.  * MODULE DESCRIPTION:                                               *
  7.  *                                                                   *
  8.  *  Module that creates an MLE and associates it with the MLE        *
  9.  *  Notebook page.                                                   *
  10.  *                                                                   *
  11.  * HISTORY:                                                          *
  12.  *                                                                   *
  13.  *  11-28-92 - Program coded.                                        *
  14.  *                                                                   *
  15.  *  Rick Fishman                                                     *
  16.  *  Code Blazers, Inc.                                               *
  17.  *  4113 Apricot                                                     *
  18.  *  Irvine, CA. 92720                                                *
  19.  *  CIS ID: 72251,750                                                *
  20.  *                                                                   *
  21.  *********************************************************************/
  22.  
  23. #pragma strings(readonly)   // used for debug version of memory mgmt routines
  24.  
  25. /*********************************************************************/
  26. /*------- Include relevant sections of the OS/2 header files --------*/
  27. /*********************************************************************/
  28.  
  29. #define  INCL_WINMLE
  30. #define  INCL_WINERRORS
  31. #define  INCL_WINFRAMEMGR
  32. #define  INCL_WINMESSAGEMGR
  33. #define  INCL_WINSTDBOOK
  34. #define  INCL_WINWINDOWMGR
  35.  
  36. /**********************************************************************/
  37. /*----------------------------- INCLUDES -----------------------------*/
  38. /**********************************************************************/
  39.  
  40. #include <os2.h>
  41. #include <stdio.h>
  42. #include <stdarg.h>
  43. #include <stdlib.h>
  44. #include <string.h>
  45. #include "nbsize.h"
  46.  
  47. /*********************************************************************/
  48. /*------------------- APPLICATION DEFINITIONS -----------------------*/
  49. /*********************************************************************/
  50.  
  51.  
  52. /**********************************************************************/
  53. /*----------------------- FUNCTION PROTOTYPES ------------------------*/
  54. /**********************************************************************/
  55.  
  56. static FNWP wpMLE;
  57.  
  58. /**********************************************************************/
  59. /*------------------------ GLOBAL VARIABLES --------------------------*/
  60. /**********************************************************************/
  61.  
  62. static PFNWP pfnwpDefMLE;
  63.  
  64. /**********************************************************************/
  65. /*-------------------------- CreateMlePage ---------------------------*/
  66. /*                                                                    */
  67. /*  CREATE AN MLE AND ASSOCIATE IT WITH A NOTEBOOK PAGE               */
  68. /*                                                                    */
  69. /*  INPUT: window handle of parent and owner,                         */
  70. /*         notebook window handle,                                    */
  71. /*         notebook page ID                                           */
  72. /*                                                                    */
  73. /*  1.                                                                */
  74. /*                                                                    */
  75. /*  OUTPUT: client window handle                                      */
  76. /*                                                                    */
  77. /*--------------------------------------------------------------------*/
  78. /**********************************************************************/
  79. HWND CreateMlePage( HWND hwndParent, HWND hwndNB, ULONG ulPageID )
  80. {
  81.     HWND hwndMLE = WinCreateWindow( hwndParent, WC_MLE, NULL,
  82.                                     MLS_VSCROLL | MLS_HSCROLL | MLS_WORDWRAP,
  83.                                     0, 0, 0, 0, hwndParent,
  84.                                     HWND_TOP, MLE_PAGE, NULL, NULL );
  85.  
  86.     if( hwndMLE )
  87.     {
  88.         WinSetWindowText( hwndMLE, "Hello, Folks. I am an MLE. I like to be "
  89.                           "sized. I know - it's a strange thing to like. "
  90.                           "The problem is that I can't turn off these "
  91.                           "feelings. That's just the way I am. Oh, well..." );
  92.  
  93.         if( !WinSendMsg( hwndNB, BKM_SETPAGEWINDOWHWND,
  94.                          MPFROMLONG( ulPageID ), MPFROMLONG( hwndMLE ) ) )
  95.         {
  96.             WinDestroyWindow( hwndMLE );
  97.  
  98.             hwndMLE = NULLHANDLE;
  99.  
  100.             Msg( "CreateMlePage SETPAGEWINDOWHWND RC(%X)", HWNDERR( hwndNB ) );
  101.         }
  102.  
  103.         pfnwpDefMLE = WinSubclassWindow( hwndMLE, wpMLE );
  104.  
  105.         if( !pfnwpDefMLE )
  106.             Msg( "CreateMlePage WinSubclassWindow RC(%X)", HWNDERR( hwndNB ) );
  107.     }
  108.     else
  109.         Msg( "CreateMlePage WinCreateWindow RC(%X)", HWNDERR( hwndNB ) );
  110.  
  111.     return hwndMLE;
  112. }
  113.  
  114. /**********************************************************************/
  115. /*------------------------------ wpMLE -------------------------------*/
  116. /*                                                                    */
  117. /*  MLE SUBCLASSED WINDOW PROCEDURE                                   */
  118. /*                                                                    */
  119. /*  INPUT: window handle, message id, message parameter 1 and 2.      */
  120. /*                                                                    */
  121. /*  1.                                                                */
  122. /*                                                                    */
  123. /*  OUTPUT: return code                                               */
  124. /*                                                                    */
  125. /*--------------------------------------------------------------------*/
  126. /**********************************************************************/
  127. MRESULT EXPENTRY wpMLE( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
  128. {
  129.     return pfnwpDefMLE( hwnd, msg, mp1, mp2 );
  130. }
  131.  
  132. /************************************************************************
  133.  *                      E N D   O F   S O U R C E                       *
  134.  ************************************************************************/
  135.