Reading QQ information needs to involve several issues:
1. It is to use the Microsoft Speech SDK 5.1 development package to conversion for text voice.
2, how to extract the information needed in the QQ window
First, you need to set QQ information to automatic pop-up.
This program can dynamically capture the pop-up QQ window
Attach a sounding thread, or add information to a specific information queue to read it in turn
HWND g_hParantWnd = :: FindWindow (NULL, "view message"); if (g_hParantWnd) {m_client = AfxBeginThread (RUNTIME_CLASS (CServerThread), THREAD_PRIORITY_ABOVE_NORMAL, 0,0, NULL); ((CServerThread *) m_client) -> ThreadProc (g_hParantWnd "ThreadProc, & g_hparantwnd, create_suspended, null);
In addition, it is necessary to explain the ID number of the various important information windows.
HWND hChildQQCode = :: GetDlgItem (g_hParantWnd, 223); // sender idHWND hChildQQName = :: GetDlgItem (g_hParantWnd, 285); // sender nickname HWND hChildQQTime = :: GetDlgItem (g_hParantWnd, 1078); // send Trust
But more importantly, the text information window, the text information window is in the form of cricheditctrl
So need to be binding
HWND HWND = :: FindWindowEx (g_hparantwnd, null, "afxwnd42", null; hwnd hchildqqtext = :: getdlgitem (hwnd, 896); // text ID cricheditctrl x; x.attach (hchildqqtext); // Bind Int NLINECount = x.getLineCount (); for (int J = 0; j {x.get, 255); list-> insertstring (i , text); str.format ("% s", text); PSPVoice-> Speak (str.allocsystring (), spf_default, null; // calls Microsoft Speech SDK interface} x.detach (); :: SendMessage (g_hparantWnd, WM_Close, 0, 0); // Turn the QQ message box
As for the call of Microsoft Speech SDK 5.1, it is basically the operation of its COM-specific interface function.
First include
#include
#include
ISPOBJECTTOKEN * PSPOBJECTTOKEN;
pSpObjectToken = NULL; if (FAILED (CoInitialize (NULL))) {AfxMessageBox ( "Error to intiliaze COM"); return false;} pSpVoice = NULL; HRESULT hr = CoCreateInstance (CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void ** ) & pspvoice; succeeded (spfindbestToken (spfindbesttoken (spfindbes, l "language = 804", null, & pspobjectToken); // 804 is Chinese speech pspvoice-> setvoice (pspObjectToken); then you can be in previous code
PSPVoice-> Speak (str.allocsystring (), spf_default, null;
Read the corresponding information.
Through the above operation, you can do one, separation extraction of QQ information, and add a small software to voice.
Suitable for recording that the owner is not in information, or when the owner does other things, it is possible to read the required information automatically.
The above content is for self-entertainment, I hope the teachers will guide a lot, thank you.