ホーム › Devices.HumanInterfaceDevice › HidP_GetSpecificValueCaps
HidP_GetSpecificValueCaps
関数指定した条件に一致するHID値の能力情報を取得する。
シグネチャ
// HID.dll
#include <windows.h>
NTSTATUS HidP_GetSpecificValueCaps(
HIDP_REPORT_TYPE ReportType,
WORD UsagePage, // optional
WORD LinkCollection, // optional
WORD Usage, // optional
HIDP_VALUE_CAPS* ValueCaps,
WORD* ValueCapsLength,
PHIDP_PREPARSED_DATA PreparsedData
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ReportType | HIDP_REPORT_TYPE | in |
| UsagePage | WORD | inoptional |
| LinkCollection | WORD | inoptional |
| Usage | WORD | inoptional |
| ValueCaps | HIDP_VALUE_CAPS* | out |
| ValueCapsLength | WORD* | inout |
| PreparsedData | PHIDP_PREPARSED_DATA | in |
戻り値の型: NTSTATUS
各言語での呼び出し定義
// HID.dll
#include <windows.h>
NTSTATUS HidP_GetSpecificValueCaps(
HIDP_REPORT_TYPE ReportType,
WORD UsagePage, // optional
WORD LinkCollection, // optional
WORD Usage, // optional
HIDP_VALUE_CAPS* ValueCaps,
WORD* ValueCapsLength,
PHIDP_PREPARSED_DATA PreparsedData
);[DllImport("HID.dll", ExactSpelling = true)]
static extern int HidP_GetSpecificValueCaps(
int ReportType, // HIDP_REPORT_TYPE
ushort UsagePage, // WORD optional
ushort LinkCollection, // WORD optional
ushort Usage, // WORD optional
IntPtr ValueCaps, // HIDP_VALUE_CAPS* out
ref ushort ValueCapsLength, // WORD* in/out
IntPtr PreparsedData // PHIDP_PREPARSED_DATA
);<DllImport("HID.dll", ExactSpelling:=True)>
Public Shared Function HidP_GetSpecificValueCaps(
ReportType As Integer, ' HIDP_REPORT_TYPE
UsagePage As UShort, ' WORD optional
LinkCollection As UShort, ' WORD optional
Usage As UShort, ' WORD optional
ValueCaps As IntPtr, ' HIDP_VALUE_CAPS* out
ByRef ValueCapsLength As UShort, ' WORD* in/out
PreparsedData As IntPtr ' PHIDP_PREPARSED_DATA
) As Integer
End Function' ReportType : HIDP_REPORT_TYPE
' UsagePage : WORD optional
' LinkCollection : WORD optional
' Usage : WORD optional
' ValueCaps : HIDP_VALUE_CAPS* out
' ValueCapsLength : WORD* in/out
' PreparsedData : PHIDP_PREPARSED_DATA
Declare PtrSafe Function HidP_GetSpecificValueCaps Lib "hid" ( _
ByVal ReportType As Long, _
ByVal UsagePage As Integer, _
ByVal LinkCollection As Integer, _
ByVal Usage As Integer, _
ByVal ValueCaps As LongPtr, _
ByRef ValueCapsLength As Integer, _
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_GetSpecificValueCaps = ctypes.windll.hid.HidP_GetSpecificValueCaps
HidP_GetSpecificValueCaps.restype = ctypes.c_int
HidP_GetSpecificValueCaps.argtypes = [
ctypes.c_int, # ReportType : HIDP_REPORT_TYPE
ctypes.c_ushort, # UsagePage : WORD optional
ctypes.c_ushort, # LinkCollection : WORD optional
ctypes.c_ushort, # Usage : WORD optional
ctypes.c_void_p, # ValueCaps : HIDP_VALUE_CAPS* out
ctypes.POINTER(ctypes.c_ushort), # ValueCapsLength : WORD* in/out
ctypes.c_ssize_t, # PreparsedData : PHIDP_PREPARSED_DATA
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('HID.dll')
HidP_GetSpecificValueCaps = Fiddle::Function.new(
lib['HidP_GetSpecificValueCaps'],
[
Fiddle::TYPE_INT, # ReportType : HIDP_REPORT_TYPE
-Fiddle::TYPE_SHORT, # UsagePage : WORD optional
-Fiddle::TYPE_SHORT, # LinkCollection : WORD optional
-Fiddle::TYPE_SHORT, # Usage : WORD optional
Fiddle::TYPE_VOIDP, # ValueCaps : HIDP_VALUE_CAPS* out
Fiddle::TYPE_VOIDP, # ValueCapsLength : WORD* in/out
Fiddle::TYPE_INTPTR_T, # PreparsedData : PHIDP_PREPARSED_DATA
],
Fiddle::TYPE_INT)#[link(name = "hid")]
extern "system" {
fn HidP_GetSpecificValueCaps(
ReportType: i32, // HIDP_REPORT_TYPE
UsagePage: u16, // WORD optional
LinkCollection: u16, // WORD optional
Usage: u16, // WORD optional
ValueCaps: *mut HIDP_VALUE_CAPS, // HIDP_VALUE_CAPS* out
ValueCapsLength: *mut u16, // WORD* 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_GetSpecificValueCaps(int ReportType, ushort UsagePage, ushort LinkCollection, ushort Usage, IntPtr ValueCaps, ref ushort ValueCapsLength, IntPtr PreparsedData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'HID_HidP_GetSpecificValueCaps' -Namespace Win32 -PassThru
# $api::HidP_GetSpecificValueCaps(ReportType, UsagePage, LinkCollection, Usage, ValueCaps, ValueCapsLength, PreparsedData)#uselib "HID.dll"
#func global HidP_GetSpecificValueCaps "HidP_GetSpecificValueCaps" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; HidP_GetSpecificValueCaps ReportType, UsagePage, LinkCollection, Usage, varptr(ValueCaps), varptr(ValueCapsLength), PreparsedData ; 戻り値は stat
; ReportType : HIDP_REPORT_TYPE -> "sptr"
; UsagePage : WORD optional -> "sptr"
; LinkCollection : WORD optional -> "sptr"
; Usage : WORD optional -> "sptr"
; ValueCaps : HIDP_VALUE_CAPS* out -> "sptr"
; ValueCapsLength : WORD* in/out -> "sptr"
; PreparsedData : PHIDP_PREPARSED_DATA -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "HID.dll" #cfunc global HidP_GetSpecificValueCaps "HidP_GetSpecificValueCaps" int, int, int, int, var, var, sptr ; res = HidP_GetSpecificValueCaps(ReportType, UsagePage, LinkCollection, Usage, ValueCaps, ValueCapsLength, PreparsedData) ; ReportType : HIDP_REPORT_TYPE -> "int" ; UsagePage : WORD optional -> "int" ; LinkCollection : WORD optional -> "int" ; Usage : WORD optional -> "int" ; ValueCaps : HIDP_VALUE_CAPS* out -> "var" ; ValueCapsLength : WORD* in/out -> "var" ; PreparsedData : PHIDP_PREPARSED_DATA -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "HID.dll" #cfunc global HidP_GetSpecificValueCaps "HidP_GetSpecificValueCaps" int, int, int, int, sptr, sptr, sptr ; res = HidP_GetSpecificValueCaps(ReportType, UsagePage, LinkCollection, Usage, varptr(ValueCaps), varptr(ValueCapsLength), PreparsedData) ; ReportType : HIDP_REPORT_TYPE -> "int" ; UsagePage : WORD optional -> "int" ; LinkCollection : WORD optional -> "int" ; Usage : WORD optional -> "int" ; ValueCaps : HIDP_VALUE_CAPS* out -> "sptr" ; ValueCapsLength : WORD* in/out -> "sptr" ; PreparsedData : PHIDP_PREPARSED_DATA -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; NTSTATUS HidP_GetSpecificValueCaps(HIDP_REPORT_TYPE ReportType, WORD UsagePage, WORD LinkCollection, WORD Usage, HIDP_VALUE_CAPS* ValueCaps, WORD* ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData) #uselib "HID.dll" #cfunc global HidP_GetSpecificValueCaps "HidP_GetSpecificValueCaps" int, int, int, int, var, var, intptr ; res = HidP_GetSpecificValueCaps(ReportType, UsagePage, LinkCollection, Usage, ValueCaps, ValueCapsLength, PreparsedData) ; ReportType : HIDP_REPORT_TYPE -> "int" ; UsagePage : WORD optional -> "int" ; LinkCollection : WORD optional -> "int" ; Usage : WORD optional -> "int" ; ValueCaps : HIDP_VALUE_CAPS* out -> "var" ; ValueCapsLength : WORD* in/out -> "var" ; PreparsedData : PHIDP_PREPARSED_DATA -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; NTSTATUS HidP_GetSpecificValueCaps(HIDP_REPORT_TYPE ReportType, WORD UsagePage, WORD LinkCollection, WORD Usage, HIDP_VALUE_CAPS* ValueCaps, WORD* ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData) #uselib "HID.dll" #cfunc global HidP_GetSpecificValueCaps "HidP_GetSpecificValueCaps" int, int, int, int, intptr, intptr, intptr ; res = HidP_GetSpecificValueCaps(ReportType, UsagePage, LinkCollection, Usage, varptr(ValueCaps), varptr(ValueCapsLength), PreparsedData) ; ReportType : HIDP_REPORT_TYPE -> "int" ; UsagePage : WORD optional -> "int" ; LinkCollection : WORD optional -> "int" ; Usage : WORD optional -> "int" ; ValueCaps : HIDP_VALUE_CAPS* out -> "intptr" ; ValueCapsLength : WORD* 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_GetSpecificValueCaps = hid.NewProc("HidP_GetSpecificValueCaps")
)
// ReportType (HIDP_REPORT_TYPE), UsagePage (WORD optional), LinkCollection (WORD optional), Usage (WORD optional), ValueCaps (HIDP_VALUE_CAPS* out), ValueCapsLength (WORD* in/out), PreparsedData (PHIDP_PREPARSED_DATA)
r1, _, err := procHidP_GetSpecificValueCaps.Call(
uintptr(ReportType),
uintptr(UsagePage),
uintptr(LinkCollection),
uintptr(Usage),
uintptr(ValueCaps),
uintptr(ValueCapsLength),
uintptr(PreparsedData),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // NTSTATUSfunction HidP_GetSpecificValueCaps(
ReportType: Integer; // HIDP_REPORT_TYPE
UsagePage: Word; // WORD optional
LinkCollection: Word; // WORD optional
Usage: Word; // WORD optional
ValueCaps: Pointer; // HIDP_VALUE_CAPS* out
ValueCapsLength: Pointer; // WORD* in/out
PreparsedData: NativeInt // PHIDP_PREPARSED_DATA
): Integer; stdcall;
external 'HID.dll' name 'HidP_GetSpecificValueCaps';result := DllCall("HID\HidP_GetSpecificValueCaps"
, "Int", ReportType ; HIDP_REPORT_TYPE
, "UShort", UsagePage ; WORD optional
, "UShort", LinkCollection ; WORD optional
, "UShort", Usage ; WORD optional
, "Ptr", ValueCaps ; HIDP_VALUE_CAPS* out
, "Ptr", ValueCapsLength ; WORD* in/out
, "Ptr", PreparsedData ; PHIDP_PREPARSED_DATA
, "Int") ; return: NTSTATUS●HidP_GetSpecificValueCaps(ReportType, UsagePage, LinkCollection, Usage, ValueCaps, ValueCapsLength, PreparsedData) = DLL("HID.dll", "int HidP_GetSpecificValueCaps(int, int, int, int, void*, void*, int)")
# 呼び出し: HidP_GetSpecificValueCaps(ReportType, UsagePage, LinkCollection, Usage, ValueCaps, ValueCapsLength, PreparsedData)
# ReportType : HIDP_REPORT_TYPE -> "int"
# UsagePage : WORD optional -> "int"
# LinkCollection : WORD optional -> "int"
# Usage : WORD optional -> "int"
# ValueCaps : HIDP_VALUE_CAPS* out -> "void*"
# ValueCapsLength : WORD* in/out -> "void*"
# PreparsedData : PHIDP_PREPARSED_DATA -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。