UtilWin32CallNativeFunctionTResult, TDelegate Method
Executes a function exported in a native dll and returns the result value.
Namespace: DevCase.Win32Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static TResult CallNativeFunction<TResult, TDelegate>(
string filepath,
string functionName,
TDelegate functionSignature,
params Object[] parameters
)
Public Shared Function CallNativeFunction(Of TResult, TDelegate) (
filepath As String,
functionName As String,
functionSignature As TDelegate,
ParamArray parameters As Object()
) As TResult
Dim filepath As String
Dim functionName As String
Dim functionSignature As TDelegate
Dim parameters As Object()
Dim returnValue As TResult
returnValue = UtilWin32.CallNativeFunction(filepath,
functionName, functionSignature,
parameters)
public:
generic<typename TResult, typename TDelegate>
static TResult CallNativeFunction(
String^ filepath,
String^ functionName,
TDelegate functionSignature,
... array<Object^>^ parameters
)
static member CallNativeFunction :
filepath : string *
functionName : string *
functionSignature : 'TDelegate *
parameters : Object[] -> 'TResult
No code example is currently available or this language may not be supported.
- filepath String
-
The file path of the native dll.
- functionName String
-
The name of the function to be executed.
- functionSignature TDelegate
-
A Delegate that will represent the signature of the native function.
- parameters Object
-
An argument list for the invoked function.
This is an array of objects with the same number, order, and type as the parameters of the function to be invoked.
If there are no parameters, parameters should be null.If the method
Any object in this array that is not explicitly initialized with a value will contain the default value for
that object type.
For reference-type elements, this value is .
For value-type elements, this value is 0, 0.0, or false, depending on the specific element type.
- TResult
-
The Type of the value returned by the native function.
- TDelegate
-
The Type of the source Delegate
that will represent the signature of the native function.
TResult
The result of calling the native function.
This is a code example.
No code example is currently available or this language may not be supported.
Public Module Module1
''' ----------------------------------------------------------------------------------------------------
''' <summary>
''' A delegate to call DllRegisterServer or DllUnregisterServer functions in a native dll.
''' </summary>
''' ----------------------------------------------------------------------------------------------------
''' <returns>
''' The result of calling DllRegisterServer or DllUnregisterServer functions in a native dll.
''' </returns>
''' ----------------------------------------------------------------------------------------------------
<UnmanagedFunctionPointer(CallingConvention.StdCall)>
Friend Delegate Function PointerToRegistrationMethodInvoker() As Integer
Public Sub Main()
Dim result As Integer =
CallNativeFunction(Of Integer, PointerToRegistrationMethodInvoker)(filepath, "DllRegisterServer", Nothing)
Dim result As Integer = methodInvoker.Invoke()
If (result <> 0) Then
' To-Do?: Handle specific errors...
End If
End Sub
End Module
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.