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 >
Wrap
Text File
|
1994-02-08
|
11KB
|
231 lines
/***********************************************************************/
/* */
/* COPYRIGHT: */
/* */
/* Copyright (C) International Business Machine Corp, 1991,1994. */
/* */
/* DISCLAIMER OF WARRANTIES: */
/* */
/* The following enclosed code is sample code created by IBM */
/* Corporation. This code is not part of any standard IBM product */
/* and is provided to you solely for the purpose of assisting you in */
/* the development of your applications. The code is provided */
/* "AS IS", without warranty of any kind. IBM shall not be liable for */
/* any damages arising out of your use of the sample code, even if */
/* they have been advised of the possibility of such damages. */
/* */
/* */
/* PROGRAM NAME: <ELMO.EXE> */
/* */
/* FILE NAME: ELMO_SPK.C */
/* */
/* DESCRIPTIVE NAME: Process speaker parameters for */
/* Elmo's Trusty Dictator */
/* */
/* STATUS: REVISION 1 */
/* */
/* */
/* FUNCTION: Contains the dialog procedure for the speaker */
/* parameters */
/* */
/* NOTES: */
/* */
/* MODULE STRUCTURE: */
/* */
/* - DlgProcSpeakerP */
/* */
/* */
/* DEPENDENCIES: */
/* */
/* - elmo.h Elmo defines */
/* - smapi.h IPDS API defines */
/* */
/* */
/* MODULE TYPE: (C language) */
/* */
/* */
/* CHANGE ACTIVITY: AS FOLLOWS */
/* */
/* FLAG REASON RLSE DATE ORIGIN DESCRIPTION */
/* ---- -------- ---- ------ ------ ----------- */
/* 0001 931102 JAF created */
/* */
/***********************************************************************/
#define INCL_WIN
#define INCL_DOS
#define INCL_GPIBITMAPS
/*---------------------------------------------------------------------*/
/* application system include files */
/*---------------------------------------------------------------------*/
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*---------------------------------------------------------------------*/
/* application include files */
/*---------------------------------------------------------------------*/
#include "elmo.h"
/*---------------------------------------------------------------------*/
/* IBM Personal Dictation System api include files */
/*---------------------------------------------------------------------*/
#include <smapi.h>
extern PINSTANCEDATA p;
/***********************************************************************/
/* FUNCTION: DlgProcSpeakerP */
/* */
/* PURPOSE : Dialog procedure for processing speaker parameters */
/* */
/* INPUTS : hwnd - handle to the window */
/* msg - message to be processed */
/* mp1 - first message parameter */
/* mp2 - second message parameter */
/* */
/* OUTPUTS : returns - FALSE on completion */
/* */
/* GLOBALS : NONE */
/* */
/***********************************************************************/
MRESULT EXPENTRY DlgProcSpeakerP ( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2 )
{
/*---------------------*/
/* process the message */
/*---------------------*/
switch ( msg ) {
case WM_COMMAND:
switch ( SHORT1FROMMP( mp1 ) ) {
case CMD_STARTSESSDLG :
case DID_OK:
/*--------------------*/
/* get the speaker ID */
/*--------------------*/
WinQueryDlgItemText ( hwnd,
SPKRID_EF,
sizeof ( p->szSpeakerId ),
p->szSpeakerId );
/*--------------*/
/* get the task */
/*--------------*/
WinQueryDlgItemText ( hwnd,
TASK_EF,
sizeof ( p->szTask ),
p->szTask );
/*-----------------------*/
/* get the enrollment ID */
/*-----------------------*/
WinQueryDlgItemText ( hwnd,
ENROLLID_EF,
sizeof ( p->szEnrollId ),
p->szEnrollId );
/*-----------------------*/
/* set the enrollment ID */
/*-----------------------*/
SmSetAttribute ( SmNenrollId, (long) p->szEnrollId );
/*--------------*/
/* set the task */
/*--------------*/
SmSetAttribute ( SmNtask , (long) p->szTask );
/*--------------------*/
/* set the speaker ID */
/*--------------------*/
SmSetAttribute ( SmNuserId , (long) p->szSpeakerId );
/*------------------------------*/
/* check for OK button selected */
/*------------------------------*/
if ( ( SHORT1FROMMP( mp1 ) ) == DID_OK )
/*---------------------------------------*/
/* dismiss the start sesssion dialog box */
/*---------------------------------------*/
WinDismissDlg ( hwnd, DID_OK );
else
/*--------------------------------------*/
/* display the start session dialog box */
/*--------------------------------------*/
WinDismissDlg ( hwnd, CMD_STARTSESSDLG );
break;
case DID_CANCEL:
/*---------------------------------------*/
/* dismiss the start sesssion dialog box */
/*---------------------------------------*/
WinDismissDlg ( hwnd, DID_CANCEL );
break;
}
break;
case WM_CONTROL:
break;
case WM_INITDLG:
/*-------------------------------------------*/
/* set the maximum length for the speaker ID */
/*-------------------------------------------*/
WinSendDlgItemMsg ( hwnd,
SPKRID_EF,
EM_SETTEXTLIMIT,
MPFROM2SHORT( SM_MAX_SPEAKEID_LEN, 0 ),
0L );
/*-------------------------------------*/
/* set the maximum length for the task */
/*-------------------------------------*/
WinSendDlgItemMsg ( hwnd,
TASK_EF,
EM_SETTEXTLIMIT,
MPFROM2SHORT( SM_MAX_STRING_LEN, 0 ),
0L );
/*----------------------------------------------*/
/* set the maximum length for the enrollment ID */
/*----------------------------------------------*/
WinSendDlgItemMsg ( hwnd,
ENROLLID_EF,
EM_SETTEXTLIMIT,
MPFROM2SHORT( SM_MAX_ENROLLID_LEN, 0 ),
0L );
/*------------------------*/
/* display the speaker ID */
/*------------------------*/
WinSetWindowText ( WinWindowFromID ( hwnd, SPKRID_EF ) , p->szSpeakerId );
/*------------------*/
/* display the task */
/*------------------*/
WinSetWindowText ( WinWindowFromID ( hwnd, TASK_EF ) , p->szTask );
/*---------------------------*/
/* display the enrollment ID */
/*---------------------------*/
WinSetWindowText ( WinWindowFromID ( hwnd, ENROLLID_EF ), p->szEnrollId );
break;
case WM_PAINT:
/*-----------------------------------*/
/* call the default window procedure */
/*-----------------------------------*/
return ( WinDefDlgProc ( hwnd, msg, mp1, mp2 ) );
default:
/*-----------------------------------*/
/* call the default window procedure */
/*-----------------------------------*/
return ( WinDefDlgProc ( hwnd, msg, mp1, mp2 ) );
}
return ( FALSE );
}