Click or drag to resize

EnumFromName

Converts the string name of an enum value to its numeric value.

template <typename T>
bool EnumFromName(const CString& strName, T& enumVal) const;
Parameters
strName

[in] String name of an enum value.

enumVal

[out] Enum value associated with the specified name.

Return Value

Returns true if the conversion was successful, otherwise false.

Example

The following example demonstrates use of the EnumFromName function.

C++
// CoAcme4321.cpp
HRESULT Acme4321::ConfigureTrigger()
{
  HRESULT hr = S_OK;

  IviFgenTriggerSource eSource;
  EnumFromString(_T("IviFgenTriggerSourceInternal"), eSource);

  ATLASSERT(eSource == IviFgenTriggerSourceInternal);

  return hr;
}
See Also

Other Resources

Download a complete CHM version of this documentation here.