home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vptool.zip / vptext.c < prev    next >
Text File  |  1994-01-19  |  22KB  |  624 lines

  1.  
  2. /* Copyright HockWare, Inc. 1994 */
  3.  
  4. #define  INCL_WIN                   /* required to use Win APIs.           */
  5. #define  INCL_DOS
  6. #define  INCL_PM                    /* required to use PM APIs.            */
  7. #define  INCL_WINHELP               /* required to use IPF.                */
  8.  
  9. #include <os2.h>
  10. #include <os2me.h>
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <string.h>
  14.  
  15.  
  16.  
  17. #define VPText_Class_Source
  18. #include "VPText.ih"
  19.  
  20. VPLOGICITEM Logic[] = {
  21.           {
  22.           0,
  23.           "Get item value",
  24.           "value = VpGetItemValue(window,%s)",
  25.           0,
  26.           0
  27.           },
  28.           {
  29.           0,
  30.           "Set item value",
  31.           "CALL VpSetItemValue window,%s,value ",
  32.           0,
  33.           0
  34.           },
  35.           { /* this record marks the end of the list */
  36.           0,
  37.           "",
  38.           "",
  39.           0,
  40.           0
  41.           }
  42.        };
  43.  
  44.  
  45. PSZ szClass="TestWndClass";
  46.  
  47. typedef struct _MYCDATA{
  48.    ULONG cb;
  49.    /* remaining data is programmer defined */
  50.    GRADIENTL gradient;  /* angle of rotation */
  51. }MYCDATA;
  52. typedef MYCDATA *PMYCDATA;
  53.  
  54. /* default angle of 0 degrees */
  55. MYCDATA defaultData= { sizeof(MYCDATA), {1,0}};
  56.  
  57. #define MAXTEXTLENGTH 255
  58.  
  59. /* We use QWL_USER+4 to save our control data pointer.        */
  60. /* Note that QWL_USER is reserved for VisPro/REXX             */
  61. /* When we registered our window class, we allocated 12 extra */
  62. /* bytes for window words for three LONGs.                    */
  63. /*      QWL_USER   - reserved for Vispro/REXX                 */
  64. /*      QWL_USER+4 - reserved for control data                */
  65. /*      QWL_USER+8 - reserved for text                        */
  66. MRESULT EXPENTRY TestWndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
  67. {
  68.   PMYCDATA pCData = (PMYCDATA)WinQueryWindowULong(hwnd, QWL_USER+4);
  69.   PSZ pszText = (PSZ)WinQueryWindowULong(hwnd, QWL_USER+8);
  70.   PMYCDATA pCreate;
  71.   PCREATESTRUCT pCreateStruct;
  72.  
  73.   switch (msg) {
  74.   /* we are creating our control */
  75.   case WM_CREATE:
  76.      /* if data was passed in */
  77.      if (pCreate=(PMYCDATA)PVOIDFROMMP(mp1)) {
  78.         /* allocate memory for the control data */
  79.         DosAllocMem((PPVOID) &pCData,
  80.                            (ULONG) pCreate->cb,
  81.                            PAG_COMMIT|PAG_READ | PAG_WRITE);
  82.  
  83.         /* copy the data that is passed in */
  84.         memcpy((PBYTE)pCData, (PBYTE) pCreate, pCreate->cb);
  85.  
  86.         /* save the control data pointer */
  87.         WinSetWindowULong(hwnd, QWL_USER+4, (ULONG)pCData);
  88.      } /* endif */
  89.      /* allocate memory for the text */
  90.      DosAllocMem((PPVOID) &pszText,
  91.                         (ULONG) MAXTEXTLENGTH+1,
  92.                         PAG_COMMIT|PAG_READ | PAG_WRITE);
  93.      /* save the text pointer */
  94.      WinSetWindowULong(hwnd, QWL_USER+8, (ULONG)pszText);
  95.      /* initialize to a NULL string */
  96.      strcpy(pszText,"");
  97.      pCreateStruct=(PCREATESTRUCT)mp2;
  98.      if (pCreateStruct) {
  99.         /* copy the text into the buffer provided */
  100.         strncpy(pszText, pCreateStruct->pszText,  MAXTEXTLENGTH);
  101.  
  102.         /* NULL terminate the string */
  103.         pszText[MAXTEXTLENGTH]=0;
  104.      }
  105.      break;
  106.   case WM_QUERYWINDOWPARAMS:
  107.      {
  108.         PWNDPARAMS pWndParams = (PWNDPARAMS)PVOIDFROMMP(mp1);
  109.         MRESULT mr;
  110.  
  111.         /* call the default window proc first so that presentation
  112.         /* parameters are handled */
  113.  
  114.         mr = WinDefWindowProc( hwnd, msg, mp1, mp2 );
  115.         if (pWndParams) {
  116.            if (pCData) {
  117.               if (pWndParams->fsStatus & WPM_CBCTLDATA) {
  118.                  pWndParams->cbCtlData = pCData->cb;
  119.                  mr=(MRESULT)TRUE;
  120.               } /* endif */
  121.               if (pWndParams->fsStatus & WPM_CTLDATA) {
  122.                  pWndParams->cbCtlData = pCData->cb;
  123.                  memcpy((PBYTE)pWndParams->pCtlData, (PBYTE)pCData,  pCData->cb);
  124.                  mr=(MRESULT)TRUE;
  125.               } /* endif */
  126.            } /* endif */
  127.  
  128.            /* responding to WinQueryWindowTextLength */
  129.            if (pWndParams->fsStatus & WPM_CCHTEXT) {
  130.               pWndParams->cchText = strlen(pszText);
  131.               mr=(MRESULT)TRUE;
  132.            } /* endif */
  133.  
  134.            /* responding to WinQueryWindowText */
  135.            if (pWndParams->fsStatus & WPM_TEXT) {
  136.  
  137.               /* copy the text into the buffer provided */
  138.               strncpy(pWndParams->pszText, pszText,  pWndParams->cchText);
  139.  
  140.               /* NULL terminate the string */
  141.               pWndParams->pszText[pWndParams->cchText]=0;
  142.               mr=(MRESULT)TRUE;
  143.            } /* endif */
  144.         } /* endif */
  145.         return mr;
  146.      }
  147.      break;
  148.   case WM_SETWINDOWPARAMS:
  149.      {
  150.         PWNDPARAMS pWndParams = (PWNDPARAMS)PVOIDFROMMP(mp1);
  151.         MRESULT mr;
  152.  
  153.         mr = WinDefWindowProc( hwnd, msg, mp1, mp2 );
  154.         if (pWndParams) {
  155.            if (pWndParams->fsStatus & WPM_CTLDATA) {
  156.               if (pCData) {
  157.                  DosFreeMem(pCData);
  158.               } /* endif */
  159.               DosAllocMem((PPVOID) &(pCData),
  160.                                  (ULONG) pWndParams->cbCtlData,
  161.                                  PAG_COMMIT|PAG_READ | PAG_WRITE);
  162.               WinSetWindowULong(hwnd, QWL_USER+4, (ULONG)pCData);
  163.               memcpy((PBYTE)pCData, (PBYTE)pWndParams->pCtlData,  pWndParams->cbCtlData);
  164.               WinInvalidateRect(hwnd, 0, 0);
  165.               mr=(MRESULT)TRUE;
  166.            } /* endif */
  167.  
  168.            /* responding to WinQueryWindowText */
  169.            if (pWndParams->fsStatus & WPM_TEXT) {
  170.  
  171.               /* copy the text into the buffer provided */
  172.               strncpy(pszText, pWndParams->pszText,  MAXTEXTLENGTH);
  173.  
  174.               /* NULL terminate the string */
  175.               pszText[MAXTEXTLENGTH]=0;
  176.               WinInvalidateRect(hwnd, 0, 0);
  177.               mr=(MRESULT)TRUE;
  178.            } /* endif */
  179.         } /* endif */
  180.         return mr;
  181.      }
  182.      break;
  183.   case WM_PAINT:
  184.      {
  185.         HPS hps;
  186.         RECTL rectlPaint;
  187.         ULONG lTextColor, lBackColor;
  188.         ULONG ulPPIndex;
  189.         SWP swp;
  190.         POINTL ptlPoint;
  191.  
  192.         WinQueryWindowPos(hwnd,&swp);
  193.         hps=WinBeginPaint(hwnd, 0, &rectlPaint);
  194.  
  195.         /* put PS into RGB color mode */
  196.         GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0 );
  197.  
  198.         if (!WinQueryPresParam(hwnd,PP_BACKGROUNDCOLOR,0,&ulPPIndex,
  199.               sizeof(LONG),&lBackColor,QPF_NOINHERIT)) {
  200.            lBackColor=WinQuerySysColor(HWND_DESKTOP,SYSCLR_WINDOW, 0);
  201.         } /* endif */
  202.  
  203.         if (!WinQueryPresParam(hwnd,PP_FOREGROUNDCOLOR,0,&ulPPIndex,
  204.               sizeof(LONG),&lTextColor,QPF_NOINHERIT)) {
  205.            lTextColor=WinQuerySysColor(HWND_DESKTOP,SYSCLR_ICONTEXT, 0);
  206.         } /* endif */
  207.  
  208.         WinFillRect(hps, &rectlPaint, lBackColor);
  209.         ptlPoint.x=0;
  210.         ptlPoint.y=0;
  211.         GpiMove(hps,&ptlPoint);
  212.         ptlPoint.x=swp.cx-1;
  213.         ptlPoint.y=swp.cy-1;
  214.         GpiBox(hps,DRO_OUTLINE,&ptlPoint,0,0);
  215.  
  216.  
  217.         /* draw your control and its text here */
  218.         ptlPoint.x=0;
  219.         ptlPoint.y=0;
  220.         GpiSetCharAngle(hps,&pCData->gradient);
  221.         GpiSetCharMode(hps,CM_MODE3);
  222.         GpiSetColor(hps,lTextColor);
  223.         GpiSetDrawControl(hps,DCTL_DISPLAY,DCTL_OFF);
  224.         GpiSetDrawControl(hps,DCTL_BOUNDARY,DCTL_ON);
  225.         GpiCharStringAt(hps, &ptlPoint,strlen(pszText),pszText);
  226.         GpiQueryBoundaryData(hps,&rectlPaint);
  227.         GpiSetDrawControl(hps,DCTL_DISPLAY,DCTL_ON);
  228.         GpiSetDrawControl(hps,DCTL_BOUNDARY,DCTL_OFF);
  229.         ptlPoint.x=-rectlPaint.xLeft;
  230.         ptlPoint.y=-rectlPaint.yBottom;
  231.         GpiCharStringAt(hps, &ptlPoint,strlen(pszText),pszText);
  232.  
  233.         WinEndPaint(hps);
  234.      }
  235.      break;
  236.   case WM_DESTROY:
  237.      if (pCData)
  238.         DosFreeMem(pCData);
  239.      if (pszText)
  240.         DosFreeMem(pszText);
  241.      break;
  242.   case WM_PRESPARAMCHANGED:
  243.      WinInvalidateRect(hwnd,0,FALSE);
  244.      break;
  245.   default:
  246.      return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  247.   } /* endswitch */
  248.   return (MRESULT) FALSE;
  249. }
  250. /* dialog procedure for the Styles page dialog procedure */
  251. MRESULT EXPENTRY StyleDlgProc( HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2 )
  252. {
  253.    SOMAny * somSelf = (SOMAny *)WinQueryWindowULong(hwndDlg, QWL_USER);
  254.    ULONG ulStyle;
  255.    ULONG ulStyleOld;
  256.    BOOL bRecreate;
  257.    PMYCDATA pCData;
  258.    BOOL bCDataChanged;
  259.    WNDPARAMS wndparams;
  260.    MYCDATA cData;
  261.    CHAR pszText[32];
  262.  
  263.    switch (msg) {
  264.    case WM_INITDLG:
  265.       somSelf=(SOMAny *)PVOIDFROMMP(mp2);
  266.       WinSetWindowULong(hwndDlg, QWL_USER, (ULONG)somSelf);
  267.       _SetInitializedFlag(somSelf,FALSE);
  268.       ulStyle = WinQueryWindowULong(_GetHwnd(somSelf), QWL_STYLE);
  269.       /* set the limits for the spin buttons */
  270.       WinSendDlgItemMsg(hwndDlg,ID_HORZSB,SPBM_SETLIMITS,
  271.                      MPFROMLONG(1000),MPFROMLONG(-1000));
  272.       WinSendDlgItemMsg(hwndDlg,ID_VERTSB,SPBM_SETLIMITS,
  273.                      MPFROMLONG(1000),MPFROMLONG(-1000));
  274.  
  275.       /* save for undoing */
  276.       _SetStyle(somSelf, ulStyle);
  277.  
  278.       WinSendMsg(hwndDlg,WM_VPRSETVALUES,0,0);
  279.  
  280.       break;
  281.    case WM_VPRSETVALUES:
  282.       ulStyle=_GetStyle(somSelf);
  283.       pCData = (PMYCDATA)WinQueryWindowULong(_GetHwnd(somSelf), QWL_USER+4);
  284.       if (ulStyle & WS_VISIBLE) {
  285.          WinCheckButton(hwndDlg, ID_VISIBLE, 1);
  286.       } else {
  287.          WinCheckButton(hwndDlg, ID_VISIBLE, 0);
  288.       } /* endif */
  289.       if (ulStyle & WS_DISABLED) {
  290.          WinCheckButton(hwndDlg, ID_DISABLED, 1);
  291.       } else {
  292.          WinCheckButton(hwndDlg, ID_DISABLED, 0);
  293.       } /* endif */
  294.       if (ulStyle & WS_GROUP) {
  295.          WinCheckButton(hwndDlg, ID_GROUP, 1);
  296.       } else {
  297.          WinCheckButton(hwndDlg, ID_GROUP, 0);
  298.       } /* endif */
  299.       if (ulStyle & WS_TABSTOP) {
  300.          WinCheckButton(hwndDlg, ID_TABSTOP, 1);
  301.       } else {
  302.          WinCheckButton(hwndDlg, ID_TABSTOP, 0);
  303.       } /* endif */
  304.       wndparams.fsStatus = WPM_CTLDATA;
  305.       wndparams.pCtlData = (PVOID)&cData;
  306.       wndparams.cbCtlData=sizeof(cData);
  307.       WinSendMsg(_GetHwnd(somSelf),WM_QUERYWINDOWPARAMS,
  308.                   MPFROMP(&wndparams),0);
  309.       WinSendDlgItemMsg(hwndDlg,ID_HORZSB,SPBM_SETCURRENTVALUE,
  310.                    MPFROMLONG(cData.gradient.x),0);
  311.       WinSendDlgItemMsg(hwndDlg,ID_VERTSB,SPBM_SETCURRENTVALUE,
  312.                    MPFROMLONG(cData.gradient.y),0);
  313.  
  314.  
  315.       _SetInitializedFlag(somSelf,TRUE);
  316.       break;
  317.    case WM_CONTROL:
  318.       if (_GetInitializedFlag(somSelf)) {
  319.           ulStyleOld = WinQueryWindowULong(_GetHwnd(somSelf),QWL_STYLE);
  320.           ulStyle = ulStyleOld;
  321.           bRecreate=FALSE;
  322.           bCDataChanged=FALSE;
  323.  
  324.           switch ( SHORT1FROMMP( mp1 ) ) {
  325.           case ID_VISIBLE:
  326.              if (SHORT2FROMMP(mp1) == BN_CLICKED) {
  327.                 WinShowWindow(_GetHwnd(somSelf),
  328.                     WinQueryButtonCheckstate(hwndDlg,SHORT1FROMMP( mp1 )));
  329.                 if (WinQueryButtonCheckstate(hwndDlg,SHORT1FROMMP( mp1 ))) {
  330.                    ulStyle |= WS_VISIBLE;
  331.                 } else {
  332.                    ulStyle &= ~WS_VISIBLE;
  333.                 } /* endif */
  334.              } /* endif */
  335.              break;
  336.           case ID_TABSTOP:
  337.              if (SHORT2FROMMP(mp1) == BN_CLICKED) {
  338.                 if (WinQueryButtonCheckstate(hwndDlg,SHORT1FROMMP( mp1 ))) {
  339.                    ulStyle |= WS_TABSTOP;
  340.                 } else {
  341.                    ulStyle &= ~WS_TABSTOP;
  342.                 } /* endif */
  343.              } /* endif */
  344.              break;
  345.           case ID_DISABLED:
  346.              if (SHORT2FROMMP(mp1) == BN_CLICKED) {
  347.                 if (WinQueryButtonCheckstate(hwndDlg,SHORT1FROMMP( mp1 ))) {
  348.                    ulStyle |= WS_DISABLED;
  349.                 } else {
  350.                    ulStyle &= ~WS_DISABLED;
  351.                 } /* endif */
  352.              } /* endif */
  353.              break;
  354.           case ID_GROUP:
  355.              if (SHORT2FROMMP(mp1) == BN_CLICKED) {
  356.                 if (WinQueryButtonCheckstate(hwndDlg,SHORT1FROMMP( mp1 ))) {
  357.                    ulStyle |= WS_GROUP;
  358.                 } else {
  359.                    ulStyle &= ~WS_GROUP;
  360.                 } /* endif */
  361.              } /* endif */
  362.              break;
  363.           case ID_HORZSB:
  364.           case ID_VERTSB:
  365.              if ((SHORT2FROMMP(mp1) == SPBN_ENDSPIN) ||
  366.                 (SHORT2FROMMP(mp1) == SPBN_KILLFOCUS)) {
  367.                 cData.cb=sizeof(cData);
  368.                 wndparams.fsStatus=WPM_CTLDATA;
  369.                 wndparams.cbCtlData=cData.cb;
  370.                 wndparams.pCtlData=(PBYTE)&cData;
  371.  
  372.                 WinSendDlgItemMsg(hwndDlg,ID_VERTSB,SPBM_QUERYVALUE,
  373.                     MPFROMP(pszText),
  374.                     MPFROM2SHORT(sizeof(pszText),SPBQ_ALWAYSUPDATE));
  375.  
  376.                 cData.gradient.x=atol(pszText);
  377.  
  378.                 WinSendDlgItemMsg(hwndDlg,ID_HORZSB,SPBM_QUERYVALUE,
  379.                     MPFROMP(pszText),
  380.                     MPFROM2SHORT(sizeof(pszText),SPBQ_ALWAYSUPDATE));
  381.  
  382.                 cData.gradient.y=atol(pszText);
  383.  
  384.                 WinSendMsg(_GetHwnd(somSelf),
  385.                            WM_SETWINDOWPARAMS, MPFROMP(&wndparams),0);
  386.  
  387.                 bCDataChanged=TRUE;
  388.              } /* endif */
  389.              break;
  390.           } /* endswitch */
  391.           if (ulStyle != ulStyleOld || bCDataChanged) {
  392.              _IndicateChanged(somSelf);
  393.              WinSetWindowULong(_GetHwnd(somSelf),QWL_STYLE,ulStyle);
  394.              if (bRecreate) {
  395.                _RecreateObject(somSelf);
  396.              } else {
  397.                _RedrawObject(somSelf);
  398.              } /* endif */
  399.           } /* endif */
  400.       } /* endif */
  401.  
  402.       break;
  403.    case WM_COMMAND:
  404.       switch (SHORT1FROMMP(mp1)) {
  405.       case ID_RESET:
  406.          /* flag the object as changed so VisPro/REXX will save it */
  407.          _IndicateChanged(somSelf);
  408.          WinSendMsg(hwndDlg,WM_VPRSETVALUES,0,0);
  409.          ulStyle=_GetStyle(somSelf);
  410.          WinShowWindow(_GetHwnd(somSelf),
  411.                  ((ulStyle & WS_VISIBLE)!=0));
  412.          WinSetWindowULong(_GetHwnd(somSelf),QWL_STYLE,ulStyle);
  413.          _RedrawObject(somSelf);
  414.  
  415.          break;
  416.       } /* endswitch */
  417.  
  418.       break;
  419.    case WM_HELP:
  420.       WinPostMsg(_QueryHelpInstance(_somGetClass(somSelf)),
  421.                  HM_DISPLAY_HELP,
  422.                  MPFROMLONG(110),
  423.                  HM_RESOURCEID);
  424.       break;
  425.    default :
  426.       return WinDefDlgProc( hwndDlg, msg, mp1, mp2 );
  427.    } /* endswitch */
  428.    return FALSE;
  429. }
  430.  
  431.  
  432. /*
  433.  *
  434.  *   METHOD:   GetStyle
  435.  *   PURPOSE:  Get the style word used for reseting
  436.  *   INVOKED:  From style dialog in editor session
  437.  *
  438.  */
  439.  
  440. SOM_Scope ULONG   SOMLINK vptexte_GetStyle(VPText *somSelf)
  441. {
  442.     VPTextData *somThis = VPTextGetData(somSelf);
  443.     VPTextMethodDebug("VPText","vptexte_GetStyle");
  444.  
  445.     return (ULONG) _ulStyle;
  446. }
  447.  
  448. /*
  449.  *
  450.  *   METHOD:   SetStyle
  451.  *   PURPOSE:  Set the style word used for reseting
  452.  *   INVOKED:  From style dialog in editor session
  453.  *
  454.  */
  455.  
  456. SOM_Scope VOID   SOMLINK vptexte_SetStyle(VPText *somSelf,
  457.                 ULONG ulStyle)
  458. {
  459.     VPTextData *somThis = VPTextGetData(somSelf);
  460.     VPTextMethodDebug("VPText","vptexte_SetStyle");
  461.  
  462.     _ulStyle=ulStyle;
  463.  
  464. }
  465.  
  466. /*
  467.  *
  468.  *   METHOD:   GetInitializedFlag
  469.  *   PURPOSE:  Get the initialized word
  470.  *   INVOKED:  From style dialog in editor session
  471.  *
  472.  */
  473.  
  474. SOM_Scope BOOL   SOMLINK vptexte_GetInitializedFlag(VPText *somSelf)
  475. {
  476.     VPTextData *somThis = VPTextGetData(somSelf);
  477.     VPTextMethodDebug("VPText","vptexte_GetInitializedFlag");
  478.  
  479.     return (BOOL) _bInitialized;
  480. }
  481.  
  482. /*
  483.  *
  484.  *   METHOD:   SetInitializedFlag
  485.  *   PURPOSE:  Set the initialized flag
  486.  *   INVOKED:  From style dialog in editor session
  487.  *
  488.  */
  489.  
  490. SOM_Scope VOID   SOMLINK vptexte_SetInitializedFlag(VPText *somSelf,
  491.                 BOOL bInitialized)
  492. {
  493.     VPTextData *somThis = VPTextGetData(somSelf);
  494.     VPTextMethodDebug("VPText","vptexte_SetInitializedFlag");
  495.  
  496.     _bInitialized=bInitialized;
  497.  
  498. }
  499. #undef SOM_CurrentClass
  500. #define SOM_CurrentClass SOMMeta
  501. SOM_Scope VOID   SOMLINK vptextc_QueryClassInfo(M_VPText *somSelf,
  502.                 PVPCLASSINFO pVpClassInfo)
  503. {
  504.     M_VPTextData *somThis = M_VPTextGetData(somSelf);
  505.     M_VPTextMethodDebug("M_VPText","vptextc_QueryClassInfo");
  506.  
  507.     if (pVpClassInfo) {
  508.        pVpClassInfo->cbSize=sizeof(VPCLASSINFO);
  509.        pVpClassInfo->pszDescName       = "Text Sample";
  510.        pVpClassInfo->pszAbbrevName     = "TXTSMP";
  511.        pVpClassInfo->bHasText          = TRUE;
  512.        pVpClassInfo->pszDefaultText    = "text samp";
  513.        pVpClassInfo->bHasCtrlData      = TRUE;
  514.        pVpClassInfo->pszWindowClass    = szClass;
  515.        pVpClassInfo->lDefaultWidth     = 48;
  516.        pVpClassInfo->lDefaultHeight    = 16;
  517.        pVpClassInfo->ulDefaultStyle    = WS_VISIBLE;
  518.        pVpClassInfo->pDefaultCtrlData  = &defaultData;
  519.        pVpClassInfo->hModResource      = _hModResource;
  520.        pVpClassInfo->lIconResID        = ID_POINTER;
  521.        pVpClassInfo->lStyleDlgID       = ID_TEXTDLG;
  522.        pVpClassInfo->pfnwpStyleDlgProc = StyleDlgProc;
  523.        pVpClassInfo->lToolHelpID       = 100;
  524.        pVpClassInfo->lStylesPageHelpID = 110;
  525.        pVpClassInfo->hwndHelpInstance  = 0;
  526.        pVpClassInfo->lNumEvents        = 0;
  527.        pVpClassInfo->Logic             = Logic;
  528.     } /* endif */
  529. }
  530.  
  531. SOM_Scope void   SOMLINK vptextc_somInitClass(M_VPText *somSelf,
  532.                 IN zString className,
  533.                 IN SOMAny *parentClass,
  534.                 IN integer4 instanceSize,
  535.                 IN int maxStaticMethods,
  536.                 IN integer4 majorVersion,
  537.                 IN integer4 minorVersion)
  538. {
  539.     M_VPTextData *somThis = M_VPTextGetData(somSelf);
  540.     CHAR ErrorBuffer[100];
  541.     M_VPTextMethodDebug("M_VPText","vptextc_somInitClass");
  542.  
  543.     DosLoadModule((PSZ) ErrorBuffer, sizeof(ErrorBuffer), "VPText",
  544.                   &_hModResource);
  545.     WinRegisterClass(                     /* Register window class        */
  546.          0,                             /* Anchor block handle          */
  547.          szClass,                       /* Window class name            */
  548.          TestWndProc,              /* Address of window procedure  */
  549.          0,                               /* Class style                  */
  550.          12                                /* No extra window words        */
  551.          );
  552.  
  553.     parent_somInitClass(somSelf,className,parentClass,instanceSize,
  554.                         maxStaticMethods,majorVersion,minorVersion);
  555. }
  556.  
  557. SOM_Scope HWND   SOMLINK vptextc_InitHelpInstance(M_VPText *somSelf)
  558. {
  559.     M_VPTextData *somThis = M_VPTextGetData(somSelf);
  560.     HELPINIT hmiHelpData;       /* Help initialization structure     */
  561.     HWND hwndHelpInstance;
  562.     CHAR pszHelp[CCHMAXPATH];
  563.     PSZ pszTemp;
  564.  
  565.     M_VPTextMethodDebug("M_VPText","vptextc_InitHelpInstance");
  566.  
  567.     if (DosScanEnv("VISPRORX",&pszTemp)) {
  568.        strcpy(pszHelp,"C:\\VISPRORX");
  569.     } else {
  570.        strcpy(pszHelp,pszTemp);
  571.     } /* endif */
  572.     strcat(pszHelp,"\\VPText.HLP");
  573.  
  574.     /**********************************************************************/
  575.     /* IPF Initialization Structure                                       */
  576.     /**********************************************************************/
  577.     /* size of initialization structure                                   */
  578.     /**********************************************************************/
  579.     hmiHelpData.cb = sizeof(HELPINIT);
  580.     /**********************************************************************/
  581.     /* store HM return code from init.                                    */
  582.     /**********************************************************************/
  583.     hmiHelpData.ulReturnCode = (ULONG)NULL;
  584.     /**********************************************************************/
  585.     /* no tutorial program                                                */
  586.     /**********************************************************************/
  587.     hmiHelpData.pszTutorialName = NULL;
  588.     /**********************************************************************/
  589.     /* indicates help table is defined in the RC file.                    */
  590.     /**********************************************************************/
  591.     hmiHelpData.phtHelpTable = 0;
  592.     /**********************************************************************/
  593.     /* action bar is not tailored                                         */
  594.     /**********************************************************************/
  595.     hmiHelpData.hmodAccelActionBarModule = 0;
  596.     hmiHelpData.idAccelTable = 0;
  597.     hmiHelpData.idActionBar = 0;
  598.     /**********************************************************************/
  599.     /* help window title                                                  */
  600.     /**********************************************************************/
  601.     hmiHelpData.pszHelpWindowTitle = "VisPro/REXX Circular Slider Help Window";
  602.     /**********************************************************************/
  603.     /* help table in not in a DLL                                         */
  604.     /**********************************************************************/
  605.     hmiHelpData.hmodHelpTableModule = 0;
  606.     /**********************************************************************/
  607.     /* help panels ID is not displayed                                    */
  608.     /**********************************************************************/
  609.     hmiHelpData.fShowPanelId = 0;
  610.     /**********************************************************************/
  611.     /* library with help panels                                           */
  612.     /**********************************************************************/
  613.     hmiHelpData.pszHelpLibraryName = pszHelp;
  614.     /**********************************************************************/
  615.     /* Create Instance of IPF pass Anchor Block handle and address of IPF */
  616.     /* initialization structure, and check that creation was successful.  */
  617.     /**********************************************************************/
  618.     hwndHelpInstance = WinCreateHelpInstance(0, &hmiHelpData);
  619.  
  620.  
  621.     return (hwndHelpInstance);
  622. }
  623.  
  624.