Microsoft Speech SDK
SAPI 5.1
ISpGrammarBuilder::GetRule
ISpGrammarBuilder::GetRule retrieves grammar rule's initial state.
HRESULT GetRule(
const WCHAR *pszRuleName,
DWORD dwRuleId,
DWORD dwAttributes,
BOOL fCreateIfNotExist,
SPSTATEHANDLE *phInitialState
);
Parameters
- pszRuleName
- [in] Address of the null-terminated string containing the grammar rule name. If NULL, no search is made for the name.
- dwRuleId
- [in] Grammar rule identifier. If zero, no search is made for the rule ID.
- dwAttributes
- [in] Grammar rule attributes for the new rule created. Ignored if the rule already exists. Must be of type SPCFGRULEATTRIBUTES. Values may be combined to allow for multiple attributes.
- fCreateIfNotExist
- [in] Boolean indicating that the grammar rule is to be created if one does not currently exist. TRUE allows the creation; FALSE does not.
- phInitialState
- [out] The initial state of the rule. May be NULL.
Return values
Value | Description |
---|---|
S_OK | Function completed successfully. |
SPERR_RULE_NOT_FOUND | No rule matching the specified criteria can be found and a new rule is not created. |
SPERR_RULE_NAME_ID_CONFLICT | One of the name and ID matches an existing rule but the other does not match the same rule. |
E_INVALIDARG | At least one parameter is invalid. Also returned when both pszRuleName and dwRuleId are NULL. |
E_OUTOFMEMORY | Not enough memory to complete operation. |