LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft Speech Recognition SDK 5... is there any one who did work with, if yes can I have some exemples... because every thing is mess up I have all kind of strange errors

When I initialized the COM... I can't go further then CoCreateInstance here is my code

///////////////////////////////
// Fichiers include externes
#include
#include
#include
#include
#include // COM is defined here
#include // SAPI is defined here
//** FIN **//

////////////////////////////////
// D�finition
#define true 1
#define false 0
#define NOWAIT 0
//** FIN **//

////////////////////////////////
// Prototype des fonctions
void fonct_load_panel(void);
ISpVoice *CreateTTS(void);
//** FIN **//


////////////////////////////////
// Variables globales

// D�finition des variables pour les fen�tres
int panel_controle;
//** FIN **//


////////////////////////////////
// Programme principale
int main (int argc, char *argv[])
{

// Variables locales
int fin = 0;
int handle_returned;
int control_ID_returned;

// Systeme vocale
HRESULT statut;
ISpVoice *cpTTSVoice;
////

// Mise en m�moire des fen�tres
fonct_load_panel();

// On affiche la fen�tre de contr�le
DisplayPanel (panel_controle);

// Initialisation de COM
statut = CoInitialize(NULL);
if(statut == S_OK)
MessagePopup("ERREUR","COM est bien initialise");

else
MessagePopup("ERREUR","Ne peut initialiser COM");

while (fin == false)
{
GetUserEvent(NOWAIT, &handle_returned, &control_ID_returned);
if(control_ID_returned == CONTROLE_COM_FERME_APPLIC)
fin = true;
}

CoUninitialize( );
QuitUserInterface (0);
Cls();

return 0;
}
//** FIN **//

//////////////////////////////
// //
// Les fonctions //
// //
//////////////////////////////


////////////////////////////////
// Fonction qui load les panels

void fonct_load_panel(void)
{
// La fen�tre de contr�le
if ((panel_controle = LoadPanel (0, "inventaire1.uir", CONTROLE)) < 0)
MessagePopup("ERREUR","Ne peut mettre en m�moire la fen�tre de contr�le");
}
//** FIN **//


//////////////////////////////////
// Fonction qui va creer le TTS

ISpVoice *CreateTTS(void)
{

// Variables locales
ISpVoice *cpTTSVoice;

if( SUCCEEDED(CoCreateInstance(&CLSID_SpVoice, NULL, CLSCTX_INPROC, &IID_ISpVoice, (void**)&cpTTSVoice)))
cpTTSVoice->AddRef();
else
cpTTSVoice = NULL;

return cpTTSVoice;
}

compiled errors are:

inventaire1.c - 2 errors
122, 21 Unknown field 'AddRef' of 'ISpVoice'.
122, 27 Found 'int' expected a function.
2 Project link errors
Undefined symbol '_IID_ISpVoice' referenced in "inventaire1.c".
Undefined symbol '_CLSID_SpVoice' referenced in "inventaire1.c".
0 Kudos
Message 1 of 2
(3,239 Views)
You need to have IID_ISpVoice and CLSID_SpVoice defined somewhere in your files to be compiled, otherwise you will continue to get these errors. I'm not really sure but they may be supplied in a header file somewhere.

Nonetheless, I had another suggestion for you and that was to try using the ActiveX Automation Controller Wizard in CVI to build an easier to use function library for manipulating the SAPI objects rather than trying to do all of the low level COM programming yourself. To launch the wizard go to the Tools >> Create ActiveX Automation Controller Wizard... menu selection and reference the LabWindows/CVI User's Manual page 3-46 for a better explanation of it and while in the wizard click the Help button for info on how to use each screen.

Jason F.
Applica
tions Engineer
National Instruments
www.ni.com/ask
0 Kudos
Message 2 of 2
(3,239 Views)