Enumerates the controls on the form.
HRESULT EnumControls( [in] DWORD dwOleContF, [in] DWORD dwWhich, [out] LPENUMUNKNOWN *ppenumUnk );
- dwOleContF [in]
Specifies the type of OLE objects to be enumerated. This parameter can be one of the following values enumerated by the OLECONTF enumeration.
When enumerating OLE controls, it is recommended that you combine the flags OLECONTF_ONLYUSER, OLECONTF_ONLYIFRUNNING, and OLECONTF_EMBEDDINGS. To include both OLE controls and VBX controls, add the OLECONTF_OTHERS flag to this list. To enumerate only VBX controls, remove the OLECONTF_EMBEDDINGS flag and include the OLECONTF_OTHERS flag.
- dwWhich [in]
Specifies the set of controls to be enumerated. This parameter can be one of the following values.
Use one of the flags GC_WCH_SIBLING, GC_WCH_CONTAINER, GC_WCH_CONTAINED, or GC_WCH_ALL in combination with any of the GC_WCH_Fxxx flags.
In VBX code, the GC_FORM flag was passed to VBGetControl to obtain a pointer to the form. In OLE control code, there is no direct replacement for this flag. Instead, pass GC_WHC_ALL to EnumControls and use the pointer to the first control in the enumeration. The first control in the enumeration is always the form when using GC_WHC_ALL.
- ppenumUnk [out]
Pointer to an enumeration of OLE objects.
This method supports the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following:
The interface pointer was retrieved.
When migrating a VBX control to an OLE control, EnumControls replaces the Visual Basic VBGetControl, which is no longer supported.
IID_IVBGetControl is defined as 40A050A0-3C31-101B-A82E-08002B2B2337