Home > Back-end >  Masters researched and consult the SDK problem, thanks
Masters researched and consult the SDK problem, thanks

Time:10-17

Come help novice to see problems, thank the warrior
Want to write a console in researched SDK speech recognition but in set identification error message function, don't know why the forehead, ask master to help see # include
# include
# include
# include
# include
Void main ()
{
: : CoInitialize (NULL);
Char STR [100].
GetConsoleTitle (STR, sizeof (STR));
HWND HWND=FindWindow (NULL, STR);
CComPtr Ir;
Retrieves the hr=ir. CoCreateInstance (CLSID_SpInprocRecognizer);
If (SUCCEEDED (hr))
{
CComPtr Ia.
Hr=SpGetDefaultTokenFromCategoryId (SPCAT_AUDIOIN, & amp; Ia, TRUE);
If (SUCCEEDED (hr))
{
Hr=ir - & gt; SetInput (ia, TRUE);
CComPtr IC.
If (SUCCEEDED (hr))
{
Hr=ir - & gt; CreateRecoContext (& amp; IC);
CComPtr Ie;
Hr=- ie & gt; SetNotifyWindowMessage (HWND WM_LBUTTONDOWN, 0, 0);
}
}
}
: : CoUninitialize ();
}

Ie - & gt; SetNotifyWindowMessage (HWND WM_LBUTTONDOWN, 0, 0); Why to run this will have a problem

CodePudding user response:

Don't understand, researched, but you are to have what problem, if it is wrong to have what error message

CodePudding user response:

ISpNotifySource: : SetNotifyWindowMessage
Tell Windows which is we identify the message
HRESULT SetNotifyWindowMessage (
The HWND HWND,
UINT Msg,
WPARAM WPARAM,
LPARAM LPARAM
);

Parameters:
HWnd: it is the main window handle to the window) (or receiving messages,
Msg: is a user-defined message,
WParam: [in] wParam that will be passed into the message handler function of the window hWnd.
LParam: [in] lParam that will be passed into the message handler function of the window hWnd.

The return value:
The Value the Description
S_OK Function completed successfully.
E_INVALIDARG hWnd is an invalid window handle.
FAILED (hr) Appropriate error message.

CodePudding user response:

reference 1st floor sololie response:
don't understand researched, but you are to have what problem, if it is wrong to have what error message


Debugging to step it appears in the figure, before the HWND is my console has been handle, the second parameter I set in order to press the mouse left key message id, but why don't understand this situation, thank you

CodePudding user response:

p!=0, an assertion fails, the p I don't know what is
You check CComPtr Ie is null, or whether the HWND of 0

CodePudding user response:

reference 4 floor sololie response:
p!=0, an assertion fails, the p I don't know what is
You check CComPtr Ie is null, or whether the HWND of 0

Thank you master,
Established by ccomptr ie seems is not successful, why don't understand, it seems some other spai interface can successfully established, see the researched the SDK documentation seems not to ispeventsource instantiation, maybe is my shallow understanding, thank you master,

ISpNotifySource
In both researched and short and researched and recognition, applications receive notifications when words have had spoken or the when phrases have had been recognized. The SAPI components that generate notifications implement an ISpNotifySource.

The ISpNotifySource and ISpNotifySink interfaces u.s only dojo.provide a mechanism for a notification but no information on The events that under caused The notification. With an ISpEventSource object, an application can retrieve information about The events that under caused The notification.

Applications will not typically use the free - threaded ISpNotifySink mechanism for identifiers SAPI event notifications. They will use one of the simplified methods of either a window message, the callback or Win32 event.

Note that both variations of callbacks as well as the window message notification window message require a pump to run on the thread that the initialized the notification source. The Callback will only be called as the result of window message processing, and will always be called on the same thread that initialized the notify source. By using Win32 events for SAPI event notification does not require a window message pump.

CodePudding user response:

reference 4 floor sololie response:
p!=0, an assertion fails, the p I don't know what is
You check CComPtr Ie is null, or whether the HWND of 0

May be Note that both variations of callbacks as well as the window message notification window message require a pump to run on the thread that the initialized the notification source.? But I don't quite understand and ispeventsource build problems,

CodePudding user response:

To learn ha ha

CodePudding user response:

Are you the installation of the machine is researched and attaching files?