ISpSREngineSite::GetRuleInfo (SAPI 5.3)

Speech API 5.3
Microsoft Speech API 5.3


ISpSREngineSite::GetRuleInfo retrieves information about a CFG rule.

HRESULT GetRuleInfo(
   SPRULEENTRY    *pRuleEntry,


[in, out] Address of the SPRULEENTRY structure that contains the grammar rule entry information.
[in] One of the grammar rule options specified in the SPRULEINFOOPT enumeration sequence. (This should always be set to SPRIO_NONE).

Return values

S_OKFunction completed successfully.
E_POINTERpRuleEntry points to invalid memory.
E_INVALIDARGEither invalid hRule rule handle or Options contains invalid flags.
FAILED (hr)Appropriate error message.


This method can be called after the engine has been informed of a rule with the ISpSREngine::RuleNotify method. This method can be used to recover rule information from the rule handle. Only the hRule rule handle field in the SPRULEENTRY needs to be filled in by the engine when calling this method. The engine will fill in:

SPRAF_TopLevel if the rule is top-level and thus can be activated for recognition.
SPRAF_Interpreter if the rule is associated with an Interpreter object for semantic processing.
SPRAF_AutoPause if the rule is auto-pause.
  • The hInitialState field, which gives the initial state of the rule. Information on this and subsequent states can be obtained by calling the ISpSREngineSite::GetStateInfo method.