Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with conversion of C++ Code

Status
Not open for further replies.

Cballe

Programmer
Apr 14, 2002
16
0
0
ZA
Hi Guys,

I would appreciate it very much if someone could help me with the following: The code beneath is Visual C++ code that opens a microphone wizard of an spaach SDK (Microsoft SDK). Could someone please help me with the way the code should look like in Visual Basic in order to do the same thing? I would appreciate it veyr much. All I want is the code that will open op die Wizard, not the checking part if the micwizard has been used already...

Best Regards
Cballe


/***************************************************************
MicWiz.cpp - Program to demonstrate the use of the microphone
setup wizard.

Copyright (c) 1997-1998 by Microsoft Corporation

*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR
* A PARTICULAR PURPOSE.
*
*/


#include <windows.h>
#include <string.h>
#include <stdio.h>
#include <mmsystem.h>
#include <initguid.h>
#include <objbase.h>
#include <objerror.h>
#include <ole2ver.h>

#include <speech.h>


/*************************************************************************
winmain - Windows main code.
*/

int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
{
BOOL fAsk = TRUE;

if (!stricmp(lpszCmdLine, &quot;/n&quot;))
fAsk = FALSE;

CoInitialize(NULL);

// create the microphone wizard
HRESULT hRes;
PISTMICWIZARD pISTMicWizard = NULL;
hRes = CoCreateInstance(CLSID_STMicWizard, NULL,
CLSCTX_ALL, IID_ISTMicWizard,
(void**)&pISTMicWizard);
if (hRes) {
MessageBox(NULL, &quot;Can't create CLSID_STMicWizard. Do you have 3.0 installed?&quot;, NULL, MB_OK);
goto closeup;
}

// see if it's been used before
MICWIZARDINFO wi;
hRes = pISTMicWizard->InfoGet(&wi);
if (hRes)
goto closeup;

if (wi.fHasRunMicWizard) {
if (!fAsk)
goto closeup;
if (IDYES != MessageBox (NULL,
&quot;You've already checked your microphone. Do you want to check it again?&quot;,
&quot;Microphone Setup Wizard&quot;, MB_YESNO))
goto closeup;
}

pISTMicWizard->Wizard(NULL, STMWU_DICTATION, WAVE_MAPPER, 16000, STMWU_CNC);

closeup:
if (pISTMicWizard)
pISTMicWizard->Release();
CoUninitialize ();

return 0;
}


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top