Thread: C++ LPWSTR

Results 1 to 7 of 7
  1. #1
    aanthonyz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Hitler's Minivan
    Posts
    483
    Reputation
    27
    Thanks
    83
    My Mood
    Relaxed

    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?
    "The best way to predict your future is to create it."

    Contributions I made:

    DirectX E-Books
    Hacking Tools
    Hacking into a PC

    Need Help?
    Send me a PM, or send me a email at : aanthonyz10@gmail.com

    Click My Dragon:


  2. #2
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    strwcmp? :3
    Ah we-a blaze the fyah, make it bun dem!

  3. #3
    aanthonyz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Hitler's Minivan
    Posts
    483
    Reputation
    27
    Thanks
    83
    My Mood
    Relaxed
    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";}
    "The best way to predict your future is to create it."

    Contributions I made:

    DirectX E-Books
    Hacking Tools
    Hacking into a PC

    Need Help?
    Send me a PM, or send me a email at : aanthonyz10@gmail.com

    Click My Dragon:


  4. #4
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    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?

  5. #5
    aanthonyz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Hitler's Minivan
    Posts
    483
    Reputation
    27
    Thanks
    83
    My Mood
    Relaxed
    My program is specifically designed to only recognize it like this:

    run Fire Fox
    "The best way to predict your future is to create it."

    Contributions I made:

    DirectX E-Books
    Hacking Tools
    Hacking into a PC

    Need Help?
    Send me a PM, or send me a email at : aanthonyz10@gmail.com

    Click My Dragon:


  6. #6
    coolcid's Avatar
    Join Date
    Sep 2008
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    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.

  7. #7
    aanthonyz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Hitler's Minivan
    Posts
    483
    Reputation
    27
    Thanks
    83
    My Mood
    Relaxed
    My program only runs on voice, so I dont use cin at all
    "The best way to predict your future is to create it."

    Contributions I made:

    DirectX E-Books
    Hacking Tools
    Hacking into a PC

    Need Help?
    Send me a PM, or send me a email at : aanthonyz10@gmail.com

    Click My Dragon: