public static PcanStatus GetHandleInformation(
PcanChannel handle,
out PcanDevice device,
out int channel
)
Public Shared Function GetHandleInformation (
handle As PcanChannel,
<OutAttribute> ByRef device As PcanDevice,
<OutAttribute> ByRef channel As Integer
) As PcanStatus
public:
static PcanStatus GetHandleInformation(
PcanChannel handle,
[OutAttribute] PcanDevice% device,
[OutAttribute] int% channel
)
The return value is a PcanStatus value. OK is returned on success. The typical errors in case of failure are:
The following example shows the use of the GetHandleInformation method to retrieve the PCAN device name and channel number associated to the given channel.
// The information about the handle is retrieved
//
PcanStatus result = Api.GetHandleInformation(PcanChannel.Lan07, out var device, out var channelNumber);
if (result != PcanStatus.OK)
{
// An error occurred
//
Api.GetErrorText(result, out var errorText);
Console.WriteLine(errorText);
}
else
{
// The information about the handle is shown
//
Console.WriteLine($"The given {nameof(PcanChannel)} represents the {device} hardware number {channelNumber}.");
}
Dim result As PcanStatus
Dim device As PcanDevice
Dim channelNumber As Integer
' The information about the handle is retrieved
'
result = Api.GetHandleInformation(PcanChannel.Lan07, device, channelNumber)
If (result <> PcanStatus.OK) Then
' An error occurred
'
Dim errorText As String = String.Empty
Api.GetErrorText(result, errorText)
Console.WriteLine(errorText)
Else
' The information about the handle is shown
'
Console.WriteLine($"The given {NameOf(PcanChannel)} represents the {device} hardware number {channelNumber}.")
End If
String^ errorText;
PcanDevice device;
int channelNumber;
// The information about the handle is retrieved
//
PcanStatus result = Api::GetHandleInformation(PcanChannel::Lan07, device, channelNumber);
if (result != PcanStatus::OK)
{
// An error occurred
//
Api::GetErrorText(result, errorText);
Console::WriteLine(errorText);
}
else
{
// The information about the handle is shown
//
Console::WriteLine("The given PcanChannel represents the {0} hardware number {1}", device, channelNumber);
}
DllNotFoundException | The underlying PCANBasic.dll library could not be found. |