共用方式為


COleControl::GetAmbientProperty

Gets the value of an ambient property of the container.

BOOL GetAmbientProperty(
   DISPID dispid,
   VARTYPE vtProp,
   void* pvProp 
);

Parameters

  • dwDispid
    The dispatch ID of the desired ambient property.

  • vtProp
    A variant type tag that specifies the type of the value to be returned in pvProp.

  • pvProp
    A pointer to the address of the variable that will receive the property value or return value. The actual type of this pointer must match the type specified by vtProp.

    vtProp

    Type of pvProp

    VT_BOOL

    BOOL*

    VT_BSTR

    CString*

    VT_I2

    short*

    VT_I4

    long*

    VT_R4

    float*

    VT_R8

    double*

    VT_CY

    CY*

    VT_COLOR

    OLE_COLOR*

    VT_DISPATCH

    LPDISPATCH*

    VT_FONT

    LPFONTDISP*

Return Value

Nonzero if the ambient property is supported; otherwise 0.

Remarks

If you use GetAmbientProperty to retrieve the ambient DisplayName and ScaleUnits properties, set vtProp to VT_BSTR and pvProp to CString*. If you are retrieving the ambient Font property, set vtProp to VT_FONT and pvProp to LPFONTDISP*.

Note that functions have already been provided for common ambient properties, such as AmbientBackColor and AmbientFont.

Requirements

Header: afxctl.h

See Also

Concepts

COleControl Class

COleControl Members

Hierarchy Chart

COleControl::AmbientForeColor

COleControl::AmbientScaleUnits

COleControl::AmbientShowGrabHandles