home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ipdssdk.zip
/
SDK
/
SAMPLES
/
ELMOQ
/
ELMOQ_QS.C
< prev
next >
Wrap
Text File
|
1994-02-07
|
12KB
|
247 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: <ELMOQ.EXE> */
/* */
/* FILE NAME: ELMOQ_QS.C */
/* */
/* DESCRIPTIVE NAME: This procedure obtains a list of the available */
/* Enrollment Scripts used for training the */
/* recognizer for a user and displays the list. */
/* */
/* STATUS: REVISION 1 */
/* */
/* */
/* FUNCTION: Contains the dialog box procedure for Query of Enrollment */
/* Scripts */
/* */
/* NOTES: */
/* */
/* MODULE STRUCTURE: */
/* */
/* - DlgProcQueryScriptsP */
/* */
/* */
/* DEPENDENCIES: */
/* */
/* - elmoq.h Elmoq defines */
/* */
/* - smapi.h speech API defines */
/* */
/* */
/* MODULE TYPE: (C language) */
/* */
/* */
/* CHANGE ACTIVITY: AS FOLLOWS */
/* */
/* FLAG REASON RLSE DATE ORIGIN DESCRIPTION */
/* ---- -------- ---- ------ ------ ----------- */
/* 0001 931207 JAF created */
/* */
/***********************************************************************/
#define INCL_WIN
#define INCL_DOS
#define INCL_DOSPROCESS
#define INCL_GPIBITMAPS
/*---------------------------------------------------------------------*/
/* application system include files */
/*---------------------------------------------------------------------*/
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*---------------------------------------------------------------------*/
/* IBM Personal Dictation System api include files */
/*---------------------------------------------------------------------*/
#include <smapi.h>
/*---------------------------------------------------------------------*/
/* application private include files */
/*---------------------------------------------------------------------*/
#include "elmoq.h"
/*---------------------------------------------------------------------*/
/* static variable declarations */
/*---------------------------------------------------------------------*/
static char language [ 256 ];
/***********************************************************************/
/* FUNCTION: DlgProcQueryScriptsP */
/* */
/* PURPOSE : Elmo's Magic Question Machine Query Scripts dialog */
/* procedure */
/* */
/* INPUTS : hwnd - window handle */
/* msg - message */
/* mp1 - first message parameter */
/* mp2 - second message parameter */
/* */
/* OUTPUTS : On Success - displays a list of available enrollment */
/* scripts */
/* On Failure - displays an error message */
/* On Return - returns FALSE */
/* */
/* GLOBALS : NONE */
/* */
/***********************************************************************/
MRESULT EXPENTRY DlgProcQueryScriptsP ( HWND hwnd,
USHORT msg,
MPARAM mp1,
MPARAM mp2 )
{
int rc;
SM_MSG reply;
unsigned long number_of_scripts;
char **scripts;
/*----------------------------*/
/*----------------------------*/
/* switch on the message type */
/*----------------------------*/
switch ( msg ) {
/*------------------------------*/
/* process the command messages */
/*------------------------------*/
case WM_COMMAND:
/*-----------------------------*/
/* switch on the command value */
/*-----------------------------*/
switch ( SHORT1FROMMP( mp1 ) ) {
/*----------------------*/
/* handle the OK button */
/*----------------------*/
case DID_OK:
/*---------------------------------*/
/* initialize the language to zero */
/*---------------------------------*/
language [ 0 ] = 0;
/*----------------------------------*/
/* prompt the user for the language */
/*----------------------------------*/
WinQueryDlgItemText ( hwnd,
LANGUAGE_EF,
sizeof ( language ),
language );
/*--------------------------------------*/
/* dismiss the query scripts dialog box */
/*--------------------------------------*/
WinDismissDlg ( hwnd, DID_OK );
/*------------------------------*/
/* query for a list of the */
/* available enrollment scripts */
/*------------------------------*/
rc = SmQueryScripts ( language, &reply );
/*-------------------------------------*/
/* if the list does not exist then */
/* display an error message and return */
/*-------------------------------------*/
if ( rc != SM_RC_OK ) {
display_msg_on_desktop ( hwnd, "SmQueryScripts call failed" );
break;
}
/*------------------------------------*/
/* get the list of enrollment scripts */
/*------------------------------------*/
SmGetScripts ( reply, &number_of_scripts, &scripts );
/*--------------------------------*/
/* if the list exists display the */
/* scripts title otherwise write */
/* no scripts */
/*--------------------------------*/
if ( number_of_scripts )
add_item_to_answer_box ( "==== scripts ====" );
else
add_item_to_answer_box ( "==== no scripts ====" );
/*--------------------------*/
/* display the full list of */
/* enrollment scripts */
/*--------------------------*/
for ( ; number_of_scripts-- > 0; scripts++ ) {
add_item_to_answer_box ( *scripts );
}
break;
/*--------------------------*/
/* handle the Cancel button */
/*--------------------------*/
case DID_CANCEL:
/*--------------------------------------*/
/* dismiss the query scripts dialog box */
/*--------------------------------------*/
WinDismissDlg ( hwnd, DID_CANCEL );
break;
}
break;
/*-----------------------------*/
/* control message, do nothing */
/*-----------------------------*/
case WM_CONTROL:
break;
/*---------------------------------------*/
/* process the initialize dialog message */
/*---------------------------------------*/
case WM_INITDLG:
/*----------------------------------------*/
/* set the maximum text limit of the */
/* language entry field to 256 characters */
/*----------------------------------------*/
WinSendDlgItemMsg ( hwnd,
LANGUAGE_EF,
EM_SETTEXTLIMIT,
MPFROM2SHORT( 256, 0 ),
0L );
break;
/*---------------------------*/
/* process the paint message */
/*---------------------------*/
case WM_PAINT:
/*--------------------------------------*/
/* involke the default dialog procedure */
/*--------------------------------------*/
return ( WinDefDlgProc ( hwnd, msg, mp1, mp2 ) );
default:
/*--------------------------------------*/
/* involke the default dialog procedure */
/*--------------------------------------*/
return ( WinDefDlgProc ( hwnd, msg, mp1, mp2 ) );
}
return ( FALSE );
}