C++ LPWSTR

Posts 1–7 of 7 · Page 1 of 1
C++ LPWSTR
How will I be able to read the contents of a LPWSTR?
Code:
hr = pPhrase->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, FALSE, &pwszText, 0);
	 std::wcout << pwszText << " (" << pParts->Rule.ulId << ") " << std::endl;
This is for Speech Recognition. What the user says gets stored in pwszText, is there a way I can read it?

Lets say it says "Run Firefox"
Can I make C++ read that and then execute a command depending on what pwszText contains?
This solved my problem:

Code:
hr = pPhrase->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, FALSE, &pwszText, 0);
	 USES_CONVERSION;
	 char * s =(W2A(pwszText));
	 if(strcmp(s,"run Fire Fox") == 0)
	 {std::cout << "It worked!\n";}
Quote Originally Posted by aanthonyz View Post
This solved my problem:

Code:
hr = pPhrase->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, FALSE, &pwszText, 0);
	 USES_CONVERSION;
	 char * s =(W2A(pwszText));
	 if(strcmp(s,"run Fire Fox") == 0)
	 {std::cout << "It worked!\n";}
But if I type it correctly, "run Firefox", it'll fail.

do you see a design flaw there?


Quote Originally Posted by aanthonyz View Post
This solved my problem:

Code:
hr = pPhrase->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, FALSE, &pwszText, 0);
	 USES_CONVERSION;
	 char * s =(W2A(pwszText));
	 if(strcmp(s,"run Fire Fox") == 0)
	 {std::cout << "It worked!\n";}
But if I type it correctly, "run Firefox", it'll fail.

do you see a design flaw there?
My program is specifically designed to only recognize it like this:

run Fire Fox
Well do you have a couple of specific kommands?
One thing you can do is have a menu come up simply stating

1=Run furefox
2=xx
3=xx

Then have the user just input a 1,2,3.

I beileve C++ is picky on capped or uncapped variables so I don't know how to tell you how to, unless you have Run Firefox, run firefox, Run FireFox and you know, variations all do the same thing.
My program only runs on voice, so I dont use cin at all
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us