DioQueryDeviceName


機能

使用可能なデバイスの一覧を取得します。

書式

Ret = DioQueryDeviceName ( Index , DeviceName , Device )

引数

Index [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
最初に0を指定し、以降+1づつ値を指定します。

DeviceName [ VB.NET: String ] [ C, C++: char * ] [ C#: out string ] [ Python: ctypes.c_char_p ]
デバイス名を返します。(例:"DIO000")

Device [ VB.NET: String ] [ C, C++: char * ] [ C#: out string ] [ Python: ctypes.c_char_p ]
デバイス名称を返します。(例:"DIO-0808LY-USB")

戻り値

Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]

定義

[Dec]

意味

DIO_ERR_SUCCESS

0

正常終了

DIO_ERR_INFO_NOT_FIND_DEVICE

10051

利用可能なデバイスが見つかりません。
デバイスが、デバイスマネージャーに登録されているかを確認してください。

STATUS_SYS_USB_NOT_FOUND_DEVINFO

20032

情報取得でデバイスの情報が見つかりませんでした。

その他のエラー(参照:エラーコード詳細

説明

使用するデバイスを選択させるような、汎用的なアプリケーションを作成する場合に利用します。 Indexを0から順に+1していき、エラーになるまで処理を繰り返してください。

C, C++の場合、

for (int Index = 0; Ret DIO_ERR_SUCCESS; Index++){
    Ret = DioQueryDeviceName ( Index , DeviceName , Device );
}
 

使用例

Index=0で情報を取得します。

VB.NET

Dim Ret As Integer
Dim DeviceName As String = Space(256)
Dim Device As String = Space(256)
Ret = DioQueryDeviceName ( 0 , DeviceName , Device )
 

C, C++

long Ret;
char DeviceName[256];
char Device[256];
Ret = DioQueryDeviceName ( 0 , DeviceName , Device );
 

C#

int Ret;
string DeviceName;
string Device;
Ret = dio.QueryDeviceName ( 0 , out DeviceName , out Device );
 

Python

Ret = ctypes.c_long()
DeviceName = ctypes.create_string_buffer(256)
Device = ctypes.create_string_buffer(256)
Ret.value = cdio.DioQueryDeviceName ( 0 , DeviceName , Device )
 

関連項目

なし