Share via


COMVariant.sCode Method

Definition

Overloads

sCode()

Gets or sets the value of a COMVariant object of the VT_ERROR data type.

sCode(Int32)

sCode()

Gets or sets the value of a COMVariant object of the VT_ERROR data type.

public:
 virtual int sCode();
public virtual int sCode ();
abstract member sCode : unit -> int
override this.sCode : unit -> int
Public Overridable Function sCode () As Integer

Returns

The current value.

Remarks

If you pass in a value that has a different data type than the object, the data type of the object will be changed to match the data type of the value. A COMVariant object has an scode data type if its data type is set to COMVariantType::VT_ERROR. The scode data type is a COM data type that is equivalent to the Win32 HRESULT data type, which is most used as return values for COM functions.

The following example creates a new COMVariant object of type VT_ERROR and sets the value to 0x80001004.

{ 
    COMVariant var = new COMVariant( 
        COMVariantInOut::IN_OUT,  
        COMVariantType::VT_ERROR); 
    // Set value of the object 
    var.sCode(0x80001004); 
}

Applies to

sCode(Int32)

public:
 virtual int sCode(int _newValue);
public virtual int sCode (int _newValue);
abstract member sCode : int -> int
override this.sCode : int -> int
Public Overridable Function sCode (_newValue As Integer) As Integer

Parameters

_newValue
Int32

The new value; optional.

Returns

Applies to