ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabWindows/CVI

CDotNetInvokeMember

int CDotNetInvokeMember (CDotNetAssemblyHandle assembly, const char *typeName, CDotNetHandle instance, int invokeMechanism, const char *memberName, size_t numberOfParameters, unsigned int parameterTypes[], void * parameters[], unsigned int returnType, void *returnValue, CDotNetHandle *exception);

Purpose

Calls the specified member of the specified .NET object. You can use this function to call methods, get and set properties, and get and set fields.

The signature of the called member must match the arguments you pass to the parameters of this function.

Parameters

Input
Name Type Description
assembly CDotNetAssemblyHandle The handle of the .NET assembly that defines the .NET type whose member you want to call.
Note  If you pass an invalid handle, the .NET execution engine can get corrupted. This can result in an execution engine exception that the library cannot handle, which will cause the system to terminate your program.
typeName const char * The name of the .NET type whose member you want to call.
instance CDotNetHandle The handle of the .NET object whose member you want to call.
Note  If you pass an invalid handle, the .NET execution engine can get corrupted. This can result in an execution engine exception that the library cannot handle, which will cause the system to terminate your program.
invokeMechanism int The mechanism to use to invoke the member. You must use one of the following mechanisms:

  • CDOTNET_CALL_METHOD
  • CDOTNET_GET_PROPERTY
  • CDOTNET_SET_PROPERTY
  • CDOTNET_GET_FIELD
  • CDOTNET_SET_FIELD
memberName const char * The name of the member to call.
numberOfParameters size_t The number of parameters to pass to .NET.
parameterTypes unsigned int [] An array containing the types of the parameters to pass to .NET.
parameters void * [] An array containing the parameters to pass to .NET.

Note  All the parameters must be passed by reference.
returnType unsigned int The type of the return value of the call to the member. Pass zero if there is no return value.
Output
Name Type Description
returnValue void * The return value of the call to the member.

You can pass NULL for this parameter.
exception CDotNetHandle The handle to an exception thrown by .NET.

If .NET throws an exception, you can pass this handle to CDotNetGetExceptionInfo to get information from the exception object.

You can pass NULL for this parameter.

Return Value

Name Type Description
status int A value indicating whether an error occurred. Negative error codes indicate function failure.

Error codes are defined in cvi\include\cvidotnet.h.

You can use CDotNetGetErrorDescription to get the description of an error code.

Additional Information

Library: .NET Library

Include file: cvidotnet.h

LabWindows/CVI compatibility: LabWindows/CVI 8.0 and later