BUG: “0×80070057 (E_INVALIDARG – The parameter is incorrect)” error message when you use an ATL to catch an event when an enum is used as a parameter of the event
Symptoms
An ATL event sink defined with SINK_ENTRY or SINK_ENTRY_EX will fail to catch an event when an enum is used as one of the parameters for the event. The failure code returned by IDispatch::Invoke is “0×80070057 (E_INVALIDARG – The parameter is incorrect).” The event will succeed in another container, such as Visual Basic.
Resolution
IDispEventImpl’s GetFuncInfoFromID method checks the type of the event parameters and, on encountering type VT_USERDEFINED, calls GetUserDefinedType. This method currently checks only for TKIND_ALIAS (“typedef struct” data types) and not TKIND_ENUM.
