Use IsResultExpected to ascertain whether a client expects a return value from its call to an automation function.
The OLE interface supplies information to MFC about whether the client is using or ignoring the result of a function call, and MFC in turn uses this information to determine the result of a call to IsResultExpected. If production of a return value is time- or resource-intensive, you can increase efficiency by calling this function before computing the return value.
This function returns 0 only once so that you will get valid return values from other automation functions if you call them from the automation function that the client has called.
IsResultExpected returns a nonzero value if called when an automation function call is not in progress.