home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / wpentk.zip / WBPENTK2.DSK / OEM.C < prev    next >
C/C++ Source or Header  |  1994-10-07  |  10KB  |  251 lines

  1.  
  2. /*
  3.  *  This file was generated by the SOM Compiler.
  4.  *  Generated using:
  5.  *     SOM incremental update: 2.22
  6.  */
  7.  
  8. /******************************************************************************
  9. *                                                                             *
  10. *  File Name   : OEM.C                                                        *
  11. *                                                                             *
  12. *  Description : Sample sublcass                                              *
  13. *                                                                             *
  14. *  Function:  This is a sample of a subclass of PenLocatorPen                 *
  15. *                                                                             *
  16. *  Copyright (C) 1993 IBM Corporation                                         *
  17. *                                                                             *
  18. *      DISCLAIMER OF WARRANTIES.  The following [enclosed] code is            *
  19. *      sample code created by IBM Corporation. This sample code is not        *
  20. *      part of any standard or IBM product and is provided to you solely      *
  21. *      for  the purpose of assisting you in the development of your           *
  22. *      applications.  The code is provided "AS IS", without                   *
  23. *      warranty of any kind.  IBM shall not be liable for any damages         *
  24. *      arising out of your use of the sample code, even if they have been     *
  25. *      advised of the possibility of such damages.                            *
  26. *                                                                             *
  27. *******************************************************************************/
  28.  
  29. /*
  30.  * This file was generated by the SOM Compiler
  31.  * and them updated. Please note the SOMInitModule and _DLL_InitTerm.
  32.  * FileName: oem.c.
  33.  * Generated using:
  34.  *     SOM Precompiler spc: 1.22
  35.  *     SOM Emitter emitc: 1.24
  36.  */
  37.  
  38. #define oem_Class_Source
  39. #include "oem.ih"
  40.  
  41. /* Define a global variable for the dll hmodule */
  42. HMODULE  MyModHandle = NULLHANDLE;
  43.  
  44. unsigned long  _System _DLL_InitTerm(unsigned long modhandle,
  45.                                      unsigned long flag)
  46. {
  47.    if ( flag == 0 ) /* init */
  48.    {
  49.        MyModHandle = modhandle;
  50.    }
  51.    return 1;
  52. }
  53.  
  54. VOID EXPENTRY OemSetup( HWND hwndOwner,          /* These parameters need     */
  55.                         PSZ  pszSourcePath,      /* to be specified, because  */
  56.                         PSZ  pszDestination,     /* INSTALL expects to call   */
  57.                         PSZ  pszSSDllInput,      /* the entry point as such   */
  58.                         HWND hwndObject,         /* In this example, only     */
  59.                         PSZ  achResponse)        /* pszDestination is used    */
  60. {
  61.   CHAR     szResourceDll[255];
  62.   CHAR     ErrorBuffer[100];
  63.   HMODULE  hMod;
  64.   APIRET   apiret;
  65.   ULONG    ulDrive;
  66.   ULONG    ulRet;
  67.  
  68.   /************************************************************************
  69.   * Set the default drive to where OEM is installed                       *
  70.   ************************************************************************/
  71.   szResourceDll[0] = '\0';
  72.   strcpy(szResourceDll, pszDestination);
  73.   ulDrive = (ULONG)( (szResourceDll[0] - 'A')+ 1);
  74.   apiret = DosSetDefaultDisk (ulDrive);
  75.  
  76.   /************************************************************************
  77.   * Change the directory to where OEM is installed                        *
  78.   ************************************************************************/
  79.   apiret = DosSetCurrentDir ((PSZ)strchr(szResourceDll, '\\'));
  80.  
  81.   /************************************************************************
  82.   * Noe, we need to do a DosLoadModule on this module, because            *
  83.   * WinRegisterObjectClass will not be able to find the module as         *
  84.   * loaded by INSTALL (by path). By changing directory to the directory   *
  85.   * where OEM.DLL resides, and doing a DosLoadModule, WinRegisterClass    *
  86.   * will be able to find the DLL.  The result is that during install,     *
  87.   * there are 2 copies of OEM.DLL loaded.  This will be cleaned up when   *
  88.   * the user reboots the machine after installation is complete           *
  89.   *                                                                       *
  90.   ************************************************************************/
  91.   ulRet = DosLoadModule( (PSZ) ErrorBuffer,
  92.                          sizeof(ErrorBuffer),
  93.                          "OEM",
  94.                          &hMod
  95.                       );
  96.   if ( ulRet == NO_ERROR )
  97.   {
  98.      /************************************************************************
  99.      * Create the Devices Folder, only if it does not already exist          *
  100.      ************************************************************************/
  101.      WinCreateObject("WPFolder",
  102.                      "Devices",
  103.                      "OBJECTID=<DEVICES_FOLDER>;HELPPANEL=40067;HELPLIBRARY=PSETUP.HLP",
  104.                      "<PPM_FOLDER>",
  105.                      CO_FAILIFEXISTS);
  106.  
  107.      /************************************************************************
  108.      * Register the class                                                    *
  109.      ************************************************************************/
  110.      WinRegisterObjectClass("oem", "OEM");
  111.  
  112.      /************************************************************************
  113.      *  Create the object in the Devices Folder                              *
  114.      ************************************************************************/
  115.      WinCreateObject("oem",
  116.                      "OEM Pen",
  117.                      "OBJECTID=<OEM_PEN>;CALPROG=CAL.EXE;CALPARMS=TRUE;PEN_DRIVER=Digitizer Mod 3;PEN_DEVICE=Pen",
  118.                      "<DEVICES_FOLDER>",
  119.                      CO_REPLACEIFEXISTS);
  120.   }
  121. }
  122.  
  123. VOID SOMLINK SOMInitModule()
  124. {
  125.    oemNewClass ( oem_MajorVersion,
  126.                  oem_MinorVersion);
  127. }
  128.  
  129. /*
  130.  *
  131.  *   overrides
  132.  */
  133.  
  134. #undef SOM_CurrentClass
  135. #define SOM_CurrentClass SOMInstance
  136. /*
  137.  *
  138.  *     overriden instance methods
  139.  */
  140.  
  141. SOM_Scope ULONG   SOMLINK AddUserTypePage(oem *somSelf,
  142.     HWND hwndOem)
  143. {
  144.     PAGEINFO pageinfo;
  145.     APIRET   rc;
  146.  
  147.     /* oemData  *somThis = oemGetData(somSelf); */
  148.     oemMethodDebug("oem","AddUserTypePage");
  149.  
  150.    /*************************************************************************/
  151.    /* Setup the page information structure and then insert the page into    */
  152.    /*  the settings notebook for this object.                               */
  153.    /*************************************************************************/
  154.    memset((PCH) &pageinfo, 0, sizeof(PAGEINFO));
  155.  
  156.    if ( MyModHandle )
  157.    {
  158.       pageinfo.cb                 = sizeof(PAGEINFO);
  159.       pageinfo.hwndPage           = NULLHANDLE;
  160.       pageinfo.usPageStyleFlags   = BKA_MAJOR;
  161.       pageinfo.usPageInsertFlags  = BKA_FIRST;
  162.       pageinfo.pfnwp              = (PFNWP) OemDialogProc;
  163.       pageinfo.resid              = MyModHandle;
  164.       pageinfo.dlgid              = OEM_DIALOG;
  165.       pageinfo.pszName            = "OEM";
  166.       pageinfo.pCreateParams      = (PVOID) NULL;
  167.       pageinfo.idDefaultHelpPanel = 0;
  168.       pageinfo.pHelpSubtable      = 0L;
  169.       pageinfo.pszHelpLibraryName = NULL;
  170.       return _wpInsertSettingsPage( somSelf, hwndOem, &pageinfo );
  171.    }
  172. }
  173.  
  174. /*
  175.  *
  176.  *  new class methods
  177.  *
  178.  *  none
  179.  *
  180.  *     overriden class methods
  181.  */
  182.  
  183. SOM_Scope BOOL   SOMLINK wpAddSettingsPages(oem *somSelf,
  184.                                             HWND hwndNotebook)
  185. {
  186.     /* oemData *somThis = oemGetData(somSelf); */
  187.     oemMethodDebug("oem","wpAddSettingsPages");
  188.  
  189.     if (parent_wpAddSettingsPages(somSelf, hwndNotebook) &&
  190.         _AddUserTypePage(somSelf, hwndNotebook))
  191.        return(TRUE);
  192.     else
  193.        return(FALSE);
  194. }
  195.  
  196. #undef SOM_CurrentClass
  197. #define SOM_CurrentClass SOMMeta
  198. SOM_Scope ULONG SOMLINK oemM_wpclsQueryIconData(M_oem *somSelf,
  199.                                                 PICONINFO pIconInfo)
  200. {
  201.  
  202.     /* M_oemData *somThis = M_oemGetData(somSelf); */
  203.     M_oemMethodDebug("M_oem","oemM_wpclsQueryIcon");
  204.  
  205.     if (pIconInfo)
  206.     {
  207.        pIconInfo->fFormat = ICON_RESOURCE;
  208.        pIconInfo->hmod    = MyModHandle;
  209.        pIconInfo->resid   = ID_OBJECTICON;
  210.     }
  211.  
  212.     return (sizeof(ICONINFO));
  213. }
  214.  
  215. SOM_Scope PSZ   SOMLINK oemM_wpclsQueryTitle(M_oem *somSelf)
  216. {
  217.     /* M_oemData *somThis = M_oemGetData(somSelf); */
  218.     M_oemMethodDebug("M_oem","oemM_wpclsQueryTitle");
  219.  
  220.     return ((PSZ) "OEM Pen");
  221. }
  222.  
  223. MRESULT EXPENTRY OemDialogProc(HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
  224.  
  225. {
  226.     static BOOL bDuringInit;
  227.     ULONG       ulSliderSetting;
  228.     APIRET      rc;
  229.  
  230.   switch (msg)
  231.   {
  232.      case WM_INITDLG:
  233.         /*****************************************************************
  234.         *   Perform initialization here                                  *
  235.         *****************************************************************/
  236.         return (MRESULT) FALSE;
  237.  
  238.      case WM_DESTROY:
  239.         /*****************************************************************
  240.         *   Perform clean up here                                        *
  241.         *****************************************************************/
  242.         break;
  243.  
  244.      case WM_COMMAND:
  245.      case WM_CONTROL:
  246.         return (MRESULT) FALSE;
  247.   }  /* of switch(msg)                         */
  248.  
  249.   return (WinDefDlgProc(hwndDlg, msg, mp1, mp2) );
  250. }
  251.