ホーム › Devices.HumanInterfaceDevice › HidP_GetLinkCollectionNodes
HidP_GetLinkCollectionNodes
関数HIDデバイスのリンクコレクションノード一覧を取得する。
シグネチャ
// HID.dll
#include <windows.h>
NTSTATUS HidP_GetLinkCollectionNodes(
HIDP_LINK_COLLECTION_NODE* LinkCollectionNodes,
DWORD* LinkCollectionNodesLength,
PHIDP_PREPARSED_DATA PreparsedData
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| LinkCollectionNodes | HIDP_LINK_COLLECTION_NODE* | out |
| LinkCollectionNodesLength | DWORD* | inout |
| PreparsedData | PHIDP_PREPARSED_DATA | in |
戻り値の型: NTSTATUS
各言語での呼び出し定義
// HID.dll
#include <windows.h>
NTSTATUS HidP_GetLinkCollectionNodes(
HIDP_LINK_COLLECTION_NODE* LinkCollectionNodes,
DWORD* LinkCollectionNodesLength,
PHIDP_PREPARSED_DATA PreparsedData
);[DllImport("HID.dll", ExactSpelling = true)]
static extern int HidP_GetLinkCollectionNodes(
IntPtr LinkCollectionNodes, // HIDP_LINK_COLLECTION_NODE* out
ref uint LinkCollectionNodesLength, // DWORD* in/out
IntPtr PreparsedData // PHIDP_PREPARSED_DATA
);<DllImport("HID.dll", ExactSpelling:=True)>
Public Shared Function HidP_GetLinkCollectionNodes(
LinkCollectionNodes As IntPtr, ' HIDP_LINK_COLLECTION_NODE* out
ByRef LinkCollectionNodesLength As UInteger, ' DWORD* in/out
PreparsedData As IntPtr ' PHIDP_PREPARSED_DATA
) As Integer
End Function' LinkCollectionNodes : HIDP_LINK_COLLECTION_NODE* out
' LinkCollectionNodesLength : DWORD* in/out
' PreparsedData : PHIDP_PREPARSED_DATA
Declare PtrSafe Function HidP_GetLinkCollectionNodes Lib "hid" ( _
ByVal LinkCollectionNodes As LongPtr, _
ByRef LinkCollectionNodesLength As Long, _
ByVal PreparsedData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HidP_GetLinkCollectionNodes = ctypes.windll.hid.HidP_GetLinkCollectionNodes
HidP_GetLinkCollectionNodes.restype = ctypes.c_int
HidP_GetLinkCollectionNodes.argtypes = [
ctypes.c_void_p, # LinkCollectionNodes : HIDP_LINK_COLLECTION_NODE* out
ctypes.POINTER(wintypes.DWORD), # LinkCollectionNodesLength : DWORD* in/out
ctypes.c_ssize_t, # PreparsedData : PHIDP_PREPARSED_DATA
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('HID.dll')
HidP_GetLinkCollectionNodes = Fiddle::Function.new(
lib['HidP_GetLinkCollectionNodes'],
[
Fiddle::TYPE_VOIDP, # LinkCollectionNodes : HIDP_LINK_COLLECTION_NODE* out
Fiddle::TYPE_VOIDP, # LinkCollectionNodesLength : DWORD* in/out
Fiddle::TYPE_INTPTR_T, # PreparsedData : PHIDP_PREPARSED_DATA
],
Fiddle::TYPE_INT)#[link(name = "hid")]
extern "system" {
fn HidP_GetLinkCollectionNodes(
LinkCollectionNodes: *mut HIDP_LINK_COLLECTION_NODE, // HIDP_LINK_COLLECTION_NODE* out
LinkCollectionNodesLength: *mut u32, // DWORD* in/out
PreparsedData: isize // PHIDP_PREPARSED_DATA
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("HID.dll")]
public static extern int HidP_GetLinkCollectionNodes(IntPtr LinkCollectionNodes, ref uint LinkCollectionNodesLength, IntPtr PreparsedData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'HID_HidP_GetLinkCollectionNodes' -Namespace Win32 -PassThru
# $api::HidP_GetLinkCollectionNodes(LinkCollectionNodes, LinkCollectionNodesLength, PreparsedData)#uselib "HID.dll"
#func global HidP_GetLinkCollectionNodes "HidP_GetLinkCollectionNodes" sptr, sptr, sptr
; HidP_GetLinkCollectionNodes varptr(LinkCollectionNodes), varptr(LinkCollectionNodesLength), PreparsedData ; 戻り値は stat
; LinkCollectionNodes : HIDP_LINK_COLLECTION_NODE* out -> "sptr"
; LinkCollectionNodesLength : DWORD* in/out -> "sptr"
; PreparsedData : PHIDP_PREPARSED_DATA -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "HID.dll" #cfunc global HidP_GetLinkCollectionNodes "HidP_GetLinkCollectionNodes" var, var, sptr ; res = HidP_GetLinkCollectionNodes(LinkCollectionNodes, LinkCollectionNodesLength, PreparsedData) ; LinkCollectionNodes : HIDP_LINK_COLLECTION_NODE* out -> "var" ; LinkCollectionNodesLength : DWORD* in/out -> "var" ; PreparsedData : PHIDP_PREPARSED_DATA -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "HID.dll" #cfunc global HidP_GetLinkCollectionNodes "HidP_GetLinkCollectionNodes" sptr, sptr, sptr ; res = HidP_GetLinkCollectionNodes(varptr(LinkCollectionNodes), varptr(LinkCollectionNodesLength), PreparsedData) ; LinkCollectionNodes : HIDP_LINK_COLLECTION_NODE* out -> "sptr" ; LinkCollectionNodesLength : DWORD* in/out -> "sptr" ; PreparsedData : PHIDP_PREPARSED_DATA -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; NTSTATUS HidP_GetLinkCollectionNodes(HIDP_LINK_COLLECTION_NODE* LinkCollectionNodes, DWORD* LinkCollectionNodesLength, PHIDP_PREPARSED_DATA PreparsedData) #uselib "HID.dll" #cfunc global HidP_GetLinkCollectionNodes "HidP_GetLinkCollectionNodes" var, var, intptr ; res = HidP_GetLinkCollectionNodes(LinkCollectionNodes, LinkCollectionNodesLength, PreparsedData) ; LinkCollectionNodes : HIDP_LINK_COLLECTION_NODE* out -> "var" ; LinkCollectionNodesLength : DWORD* in/out -> "var" ; PreparsedData : PHIDP_PREPARSED_DATA -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; NTSTATUS HidP_GetLinkCollectionNodes(HIDP_LINK_COLLECTION_NODE* LinkCollectionNodes, DWORD* LinkCollectionNodesLength, PHIDP_PREPARSED_DATA PreparsedData) #uselib "HID.dll" #cfunc global HidP_GetLinkCollectionNodes "HidP_GetLinkCollectionNodes" intptr, intptr, intptr ; res = HidP_GetLinkCollectionNodes(varptr(LinkCollectionNodes), varptr(LinkCollectionNodesLength), PreparsedData) ; LinkCollectionNodes : HIDP_LINK_COLLECTION_NODE* out -> "intptr" ; LinkCollectionNodesLength : DWORD* in/out -> "intptr" ; PreparsedData : PHIDP_PREPARSED_DATA -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
hid = windows.NewLazySystemDLL("HID.dll")
procHidP_GetLinkCollectionNodes = hid.NewProc("HidP_GetLinkCollectionNodes")
)
// LinkCollectionNodes (HIDP_LINK_COLLECTION_NODE* out), LinkCollectionNodesLength (DWORD* in/out), PreparsedData (PHIDP_PREPARSED_DATA)
r1, _, err := procHidP_GetLinkCollectionNodes.Call(
uintptr(LinkCollectionNodes),
uintptr(LinkCollectionNodesLength),
uintptr(PreparsedData),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // NTSTATUSfunction HidP_GetLinkCollectionNodes(
LinkCollectionNodes: Pointer; // HIDP_LINK_COLLECTION_NODE* out
LinkCollectionNodesLength: Pointer; // DWORD* in/out
PreparsedData: NativeInt // PHIDP_PREPARSED_DATA
): Integer; stdcall;
external 'HID.dll' name 'HidP_GetLinkCollectionNodes';result := DllCall("HID\HidP_GetLinkCollectionNodes"
, "Ptr", LinkCollectionNodes ; HIDP_LINK_COLLECTION_NODE* out
, "Ptr", LinkCollectionNodesLength ; DWORD* in/out
, "Ptr", PreparsedData ; PHIDP_PREPARSED_DATA
, "Int") ; return: NTSTATUS●HidP_GetLinkCollectionNodes(LinkCollectionNodes, LinkCollectionNodesLength, PreparsedData) = DLL("HID.dll", "int HidP_GetLinkCollectionNodes(void*, void*, int)")
# 呼び出し: HidP_GetLinkCollectionNodes(LinkCollectionNodes, LinkCollectionNodesLength, PreparsedData)
# LinkCollectionNodes : HIDP_LINK_COLLECTION_NODE* out -> "void*"
# LinkCollectionNodesLength : DWORD* in/out -> "void*"
# PreparsedData : PHIDP_PREPARSED_DATA -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。