home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ipdssdk.zip / SDK / SAMPLES / ELMO / ELMO_SPK.C < prev    next >
Text File  |  1994-02-08  |  11KB  |  231 lines

  1. /***********************************************************************/
  2. /*                                                                     */
  3. /* COPYRIGHT:                                                          */
  4. /*                                                                     */
  5. /* Copyright (C) International Business Machine Corp, 1991,1994.       */
  6. /*                                                                     */
  7. /* DISCLAIMER OF WARRANTIES:                                           */
  8. /*                                                                     */
  9. /* The following enclosed code is sample code created by IBM           */
  10. /* Corporation.  This code is not part of any standard IBM product     */
  11. /* and is provided to you solely for the purpose of assisting you in   */
  12. /* the development of your applications.  The code is provided         */
  13. /* "AS IS", without warranty of any kind.  IBM shall not be liable for */
  14. /* any damages arising out of your use of the sample code, even if     */
  15. /* they have been advised of the possibility of such damages.          */
  16. /*                                                                     */
  17. /*                                                                     */
  18. /* PROGRAM NAME: <ELMO.EXE>                                            */
  19. /*                                                                     */
  20. /* FILE NAME: ELMO_SPK.C                                               */
  21. /*                                                                     */
  22. /* DESCRIPTIVE NAME: Process speaker parameters for                    */
  23. /*                   Elmo's Trusty Dictator                            */
  24. /*                                                                     */
  25. /* STATUS: REVISION 1                                                  */
  26. /*                                                                     */
  27. /*                                                                     */
  28. /* FUNCTION: Contains the dialog procedure for the speaker             */
  29. /*           parameters                                                */
  30. /*                                                                     */
  31. /* NOTES:                                                              */
  32. /*                                                                     */
  33. /*    MODULE STRUCTURE:                                                */
  34. /*                                                                     */
  35. /*     - DlgProcSpeakerP                                               */
  36. /*                                                                     */
  37. /*                                                                     */
  38. /*   DEPENDENCIES:                                                     */
  39. /*                                                                     */
  40. /*     - elmo.h       Elmo defines                                     */
  41. /*     - smapi.h      IPDS API defines                                 */
  42. /*                                                                     */
  43. /*                                                                     */
  44. /* MODULE TYPE: (C language)                                           */
  45. /*                                                                     */
  46. /*                                                                     */
  47. /* CHANGE ACTIVITY: AS FOLLOWS                                         */
  48. /*                                                                     */
  49. /* FLAG  REASON  RLSE  DATE  ORIGIN   DESCRIPTION                      */
  50. /* ---- -------- ---- ------ ------   -----------                      */
  51. /*               0001 931102 JAF      created                          */
  52. /*                                                                     */
  53. /***********************************************************************/
  54.  
  55. #define    INCL_WIN
  56. #define    INCL_DOS
  57. #define    INCL_GPIBITMAPS
  58. /*---------------------------------------------------------------------*/
  59. /* application system include files                                    */
  60. /*---------------------------------------------------------------------*/
  61. #include   <os2.h>
  62. #include   <stdio.h>
  63. #include   <stdlib.h>
  64. #include   <string.h>
  65.  
  66. /*---------------------------------------------------------------------*/
  67. /* application include files                                           */
  68. /*---------------------------------------------------------------------*/
  69. #include   "elmo.h"
  70.  
  71. /*---------------------------------------------------------------------*/
  72. /* IBM Personal Dictation System api include files                     */
  73. /*---------------------------------------------------------------------*/
  74. #include   <smapi.h>
  75.  
  76. extern PINSTANCEDATA p;
  77.  
  78. /***********************************************************************/
  79. /* FUNCTION: DlgProcSpeakerP                                           */
  80. /*                                                                     */
  81. /* PURPOSE : Dialog procedure for processing speaker parameters        */
  82. /*                                                                     */
  83. /* INPUTS  : hwnd      - handle to the window                          */
  84. /*           msg       - message to be processed                       */
  85. /*           mp1       - first message parameter                       */
  86. /*           mp2       - second message parameter                      */
  87. /*                                                                     */
  88. /* OUTPUTS : returns   - FALSE on completion                           */
  89. /*                                                                     */
  90. /* GLOBALS : NONE                                                      */
  91. /*                                                                     */
  92. /***********************************************************************/
  93. MRESULT EXPENTRY DlgProcSpeakerP ( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2 )
  94. {
  95.    /*---------------------*/
  96.    /* process the message */
  97.    /*---------------------*/
  98.    switch ( msg ) {
  99.       case WM_COMMAND:
  100.          switch ( SHORT1FROMMP( mp1 ) ) {
  101.             case CMD_STARTSESSDLG :
  102.             case DID_OK:
  103.  
  104.                /*--------------------*/
  105.                /* get the speaker ID */
  106.                /*--------------------*/
  107.                WinQueryDlgItemText ( hwnd,
  108.                                      SPKRID_EF,
  109.                                      sizeof ( p->szSpeakerId ),
  110.                                      p->szSpeakerId );
  111.  
  112.                /*--------------*/
  113.                /* get the task */
  114.                /*--------------*/
  115.                WinQueryDlgItemText ( hwnd,
  116.                                      TASK_EF,
  117.                                      sizeof ( p->szTask ),
  118.                                      p->szTask );
  119.  
  120.                /*-----------------------*/
  121.                /* get the enrollment ID */
  122.                /*-----------------------*/
  123.                WinQueryDlgItemText ( hwnd,
  124.                                      ENROLLID_EF,
  125.                                      sizeof ( p->szEnrollId ),
  126.                                      p->szEnrollId );
  127.  
  128.                /*-----------------------*/
  129.                /* set the enrollment ID */
  130.                /*-----------------------*/
  131.                SmSetAttribute ( SmNenrollId, (long) p->szEnrollId  );
  132.  
  133.                /*--------------*/
  134.                /* set the task */
  135.                /*--------------*/
  136.                SmSetAttribute ( SmNtask    , (long) p->szTask      );
  137.  
  138.                /*--------------------*/
  139.                /* set the speaker ID */
  140.                /*--------------------*/
  141.                SmSetAttribute ( SmNuserId  , (long) p->szSpeakerId );
  142.  
  143.                /*------------------------------*/
  144.                /* check for OK button selected */
  145.                /*------------------------------*/
  146.                if ( ( SHORT1FROMMP( mp1 ) ) == DID_OK )
  147.                  /*---------------------------------------*/
  148.                  /* dismiss the start sesssion dialog box */
  149.                  /*---------------------------------------*/
  150.                  WinDismissDlg ( hwnd, DID_OK );
  151.                else
  152.                  /*--------------------------------------*/
  153.                  /* display the start session dialog box */
  154.                  /*--------------------------------------*/
  155.                  WinDismissDlg ( hwnd, CMD_STARTSESSDLG );
  156.  
  157.                break;
  158.  
  159.             case DID_CANCEL:
  160.  
  161.                /*---------------------------------------*/
  162.                /* dismiss the start sesssion dialog box */
  163.                /*---------------------------------------*/
  164.                WinDismissDlg ( hwnd, DID_CANCEL );
  165.                break;
  166.          }
  167.          break;
  168.       case WM_CONTROL:
  169.          break;
  170.       case WM_INITDLG:
  171.  
  172.          /*-------------------------------------------*/
  173.          /* set the maximum length for the speaker ID */
  174.          /*-------------------------------------------*/
  175.          WinSendDlgItemMsg ( hwnd,
  176.                              SPKRID_EF,
  177.                              EM_SETTEXTLIMIT,
  178.                              MPFROM2SHORT( SM_MAX_SPEAKEID_LEN, 0 ),
  179.                              0L );
  180.  
  181.          /*-------------------------------------*/
  182.          /* set the maximum length for the task */
  183.          /*-------------------------------------*/
  184.          WinSendDlgItemMsg ( hwnd,
  185.                              TASK_EF,
  186.                              EM_SETTEXTLIMIT,
  187.                              MPFROM2SHORT( SM_MAX_STRING_LEN, 0 ),
  188.                              0L );
  189.  
  190.          /*----------------------------------------------*/
  191.          /* set the maximum length for the enrollment ID */
  192.          /*----------------------------------------------*/
  193.          WinSendDlgItemMsg ( hwnd,
  194.                              ENROLLID_EF,
  195.                              EM_SETTEXTLIMIT,
  196.                              MPFROM2SHORT( SM_MAX_ENROLLID_LEN, 0 ),
  197.                              0L );
  198.  
  199.          /*------------------------*/
  200.          /* display the speaker ID */
  201.          /*------------------------*/
  202.          WinSetWindowText ( WinWindowFromID ( hwnd, SPKRID_EF )  , p->szSpeakerId );
  203.  
  204.          /*------------------*/
  205.          /* display the task */
  206.          /*------------------*/
  207.          WinSetWindowText ( WinWindowFromID ( hwnd, TASK_EF )    , p->szTask      );
  208.  
  209.          /*---------------------------*/
  210.          /* display the enrollment ID */
  211.          /*---------------------------*/
  212.          WinSetWindowText ( WinWindowFromID ( hwnd, ENROLLID_EF ), p->szEnrollId  );
  213.          break;
  214.  
  215.       case WM_PAINT:
  216.  
  217.          /*-----------------------------------*/
  218.          /* call the default window procedure */
  219.          /*-----------------------------------*/
  220.          return ( WinDefDlgProc ( hwnd, msg, mp1, mp2 ) );
  221.  
  222.      default:
  223.  
  224.          /*-----------------------------------*/
  225.          /* call the default window procedure */
  226.          /*-----------------------------------*/
  227.          return ( WinDefDlgProc ( hwnd, msg, mp1, mp2 ) );
  228.    }
  229.    return ( FALSE );
  230. }
  231.