Jaa


COMDispFunction.newmethod(COM, String, COMDispContext) Method

Definition

Creates a COMDispFunction object, which is used to access the functionality in an Automation object.

public:
 void newmethod(Dynamics::AX::Application::COM ^ _comObject, System::String ^ _functionName, Dynamics::AX::Application::COMDispContext _context);
public void newmethod (Dynamics.AX.Application.COM _comObject, string _functionName, Dynamics.AX.Application.COMDispContext _context);
override this.newmethod : Dynamics.AX.Application.COM * string * Dynamics.AX.Application.COMDispContext -> unit
Public Sub newmethod (_comObject As COM, _functionName As String, _context As COMDispContext)

Parameters

_comObject
COM

The context of the functionality to access. The following values are used: COMDispContext::METHOD, COMDispContext::PROPERTYGET, COMDispContext::PROPERTYPUT, and COMDispContext::PROPERTYPUTREF

_functionName
String

The context of the functionality to access. The following values are used: COMDispContext::METHOD, COMDispContext::PROPERTYGET, COMDispContext::PROPERTYPUT, and COMDispContext::PROPERTYPUTREF

_context
COMDispContext

The context of the functionality to access. The following values are used: COMDispContext::METHOD, COMDispContext::PROPERTYGET, COMDispContext::PROPERTYPUT, and COMDispContext::PROPERTYPUTREF

Remarks

It is important that you specify the correct context of the functionality in the COM object that you want to access, because a COM object can supply up to four functions that use the same name. Because of the possible name clashing, the context is used to distinguish the method or properties. To specify the correct context, see the documentation for the COM object that you want to access.

The following example creates an instance of COMDispFunction.

{ 
    InteropPermission perm; 
    COM com; 
    COMDispFunction funcShow; 
    COMDispFunction getValue; 
    COMDispFunction putValue; 
    ; 
    perm = new InteropPermission(InteropKind::ComInterop); 
    perm.assert(); 
    com = new COM("MyCOM.Object"); 
    funcShow = 
        new COMDispFunction(com, "show",  COMDispContext::METHOD); 
    getValue = 
        new COMDispFunction(com, "value", COMDispContext::PROPERTYGET); 
    putValue = 
        new COMDispFunction(com, "value", COMDispContext::PROPERTYPUT); 
}

Applies to