ホーム › Devices.HumanInterfaceDevice › HidP_SetUsageValue
HidP_SetUsageValue
関数HIDレポート内の指定した用途に値を設定する。
シグネチャ
// HID.dll
#include <windows.h>
NTSTATUS HidP_SetUsageValue(
HIDP_REPORT_TYPE ReportType,
WORD UsagePage,
WORD LinkCollection, // optional
WORD Usage,
DWORD UsageValue,
PHIDP_PREPARSED_DATA PreparsedData,
LPSTR Report,
DWORD ReportLength
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ReportType | HIDP_REPORT_TYPE | in | 対象のレポート種別をHIDP_REPORT_TYPE(Input/Output/Feature)で指定する。 |
| UsagePage | WORD | in | 設定する値コントロールのユーセージページを指定する。 |
| LinkCollection | WORD | inoptional | 対象のリンクコレクションを指定する。0で限定しない。 |
| Usage | WORD | in | 値を設定する対象のユーセージを指定する。 |
| UsageValue | DWORD | in | 設定する論理値をDWORDで指定する。コントロールに書き込む生の値。 |
| PreparsedData | PHIDP_PREPARSED_DATA | in | HidD_GetPreparsedDataで取得した前解析データへのポインタを指定する。 |
| Report | LPSTR | inout | 更新するレポートバッファへのポインタを指定する。 |
| ReportLength | DWORD | in | Reportバッファのバイト長を指定する。 |
戻り値の型: NTSTATUS
各言語での呼び出し定義
// HID.dll
#include <windows.h>
NTSTATUS HidP_SetUsageValue(
HIDP_REPORT_TYPE ReportType,
WORD UsagePage,
WORD LinkCollection, // optional
WORD Usage,
DWORD UsageValue,
PHIDP_PREPARSED_DATA PreparsedData,
LPSTR Report,
DWORD ReportLength
);[DllImport("HID.dll", ExactSpelling = true)]
static extern int HidP_SetUsageValue(
int ReportType, // HIDP_REPORT_TYPE
ushort UsagePage, // WORD
ushort LinkCollection, // WORD optional
ushort Usage, // WORD
uint UsageValue, // DWORD
IntPtr PreparsedData, // PHIDP_PREPARSED_DATA
[MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder Report, // LPSTR in/out
uint ReportLength // DWORD
);<DllImport("HID.dll", ExactSpelling:=True)>
Public Shared Function HidP_SetUsageValue(
ReportType As Integer, ' HIDP_REPORT_TYPE
UsagePage As UShort, ' WORD
LinkCollection As UShort, ' WORD optional
Usage As UShort, ' WORD
UsageValue As UInteger, ' DWORD
PreparsedData As IntPtr, ' PHIDP_PREPARSED_DATA
<MarshalAs(UnmanagedType.LPStr)> Report As System.Text.StringBuilder, ' LPSTR in/out
ReportLength As UInteger ' DWORD
) As Integer
End Function' ReportType : HIDP_REPORT_TYPE
' UsagePage : WORD
' LinkCollection : WORD optional
' Usage : WORD
' UsageValue : DWORD
' PreparsedData : PHIDP_PREPARSED_DATA
' Report : LPSTR in/out
' ReportLength : DWORD
Declare PtrSafe Function HidP_SetUsageValue Lib "hid" ( _
ByVal ReportType As Long, _
ByVal UsagePage As Integer, _
ByVal LinkCollection As Integer, _
ByVal Usage As Integer, _
ByVal UsageValue As Long, _
ByVal PreparsedData As LongPtr, _
ByVal Report As String, _
ByVal ReportLength As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HidP_SetUsageValue = ctypes.windll.hid.HidP_SetUsageValue
HidP_SetUsageValue.restype = ctypes.c_int
HidP_SetUsageValue.argtypes = [
ctypes.c_int, # ReportType : HIDP_REPORT_TYPE
ctypes.c_ushort, # UsagePage : WORD
ctypes.c_ushort, # LinkCollection : WORD optional
ctypes.c_ushort, # Usage : WORD
wintypes.DWORD, # UsageValue : DWORD
ctypes.c_ssize_t, # PreparsedData : PHIDP_PREPARSED_DATA
wintypes.LPSTR, # Report : LPSTR in/out
wintypes.DWORD, # ReportLength : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('HID.dll')
HidP_SetUsageValue = Fiddle::Function.new(
lib['HidP_SetUsageValue'],
[
Fiddle::TYPE_INT, # ReportType : HIDP_REPORT_TYPE
-Fiddle::TYPE_SHORT, # UsagePage : WORD
-Fiddle::TYPE_SHORT, # LinkCollection : WORD optional
-Fiddle::TYPE_SHORT, # Usage : WORD
-Fiddle::TYPE_INT, # UsageValue : DWORD
Fiddle::TYPE_INTPTR_T, # PreparsedData : PHIDP_PREPARSED_DATA
Fiddle::TYPE_VOIDP, # Report : LPSTR in/out
-Fiddle::TYPE_INT, # ReportLength : DWORD
],
Fiddle::TYPE_INT)#[link(name = "hid")]
extern "system" {
fn HidP_SetUsageValue(
ReportType: i32, // HIDP_REPORT_TYPE
UsagePage: u16, // WORD
LinkCollection: u16, // WORD optional
Usage: u16, // WORD
UsageValue: u32, // DWORD
PreparsedData: isize, // PHIDP_PREPARSED_DATA
Report: *mut u8, // LPSTR in/out
ReportLength: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("HID.dll")]
public static extern int HidP_SetUsageValue(int ReportType, ushort UsagePage, ushort LinkCollection, ushort Usage, uint UsageValue, IntPtr PreparsedData, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder Report, uint ReportLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'HID_HidP_SetUsageValue' -Namespace Win32 -PassThru
# $api::HidP_SetUsageValue(ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, Report, ReportLength)#uselib "HID.dll"
#func global HidP_SetUsageValue "HidP_SetUsageValue" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; HidP_SetUsageValue ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, varptr(Report), ReportLength ; 戻り値は stat
; ReportType : HIDP_REPORT_TYPE -> "sptr"
; UsagePage : WORD -> "sptr"
; LinkCollection : WORD optional -> "sptr"
; Usage : WORD -> "sptr"
; UsageValue : DWORD -> "sptr"
; PreparsedData : PHIDP_PREPARSED_DATA -> "sptr"
; Report : LPSTR in/out -> "sptr"
; ReportLength : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "HID.dll" #cfunc global HidP_SetUsageValue "HidP_SetUsageValue" int, int, int, int, int, sptr, var, int ; res = HidP_SetUsageValue(ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, Report, ReportLength) ; ReportType : HIDP_REPORT_TYPE -> "int" ; UsagePage : WORD -> "int" ; LinkCollection : WORD optional -> "int" ; Usage : WORD -> "int" ; UsageValue : DWORD -> "int" ; PreparsedData : PHIDP_PREPARSED_DATA -> "sptr" ; Report : LPSTR in/out -> "var" ; ReportLength : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "HID.dll" #cfunc global HidP_SetUsageValue "HidP_SetUsageValue" int, int, int, int, int, sptr, sptr, int ; res = HidP_SetUsageValue(ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, varptr(Report), ReportLength) ; ReportType : HIDP_REPORT_TYPE -> "int" ; UsagePage : WORD -> "int" ; LinkCollection : WORD optional -> "int" ; Usage : WORD -> "int" ; UsageValue : DWORD -> "int" ; PreparsedData : PHIDP_PREPARSED_DATA -> "sptr" ; Report : LPSTR in/out -> "sptr" ; ReportLength : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; NTSTATUS HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, WORD UsagePage, WORD LinkCollection, WORD Usage, DWORD UsageValue, PHIDP_PREPARSED_DATA PreparsedData, LPSTR Report, DWORD ReportLength) #uselib "HID.dll" #cfunc global HidP_SetUsageValue "HidP_SetUsageValue" int, int, int, int, int, intptr, var, int ; res = HidP_SetUsageValue(ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, Report, ReportLength) ; ReportType : HIDP_REPORT_TYPE -> "int" ; UsagePage : WORD -> "int" ; LinkCollection : WORD optional -> "int" ; Usage : WORD -> "int" ; UsageValue : DWORD -> "int" ; PreparsedData : PHIDP_PREPARSED_DATA -> "intptr" ; Report : LPSTR in/out -> "var" ; ReportLength : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; NTSTATUS HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, WORD UsagePage, WORD LinkCollection, WORD Usage, DWORD UsageValue, PHIDP_PREPARSED_DATA PreparsedData, LPSTR Report, DWORD ReportLength) #uselib "HID.dll" #cfunc global HidP_SetUsageValue "HidP_SetUsageValue" int, int, int, int, int, intptr, intptr, int ; res = HidP_SetUsageValue(ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, varptr(Report), ReportLength) ; ReportType : HIDP_REPORT_TYPE -> "int" ; UsagePage : WORD -> "int" ; LinkCollection : WORD optional -> "int" ; Usage : WORD -> "int" ; UsageValue : DWORD -> "int" ; PreparsedData : PHIDP_PREPARSED_DATA -> "intptr" ; Report : LPSTR in/out -> "intptr" ; ReportLength : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
hid = windows.NewLazySystemDLL("HID.dll")
procHidP_SetUsageValue = hid.NewProc("HidP_SetUsageValue")
)
// ReportType (HIDP_REPORT_TYPE), UsagePage (WORD), LinkCollection (WORD optional), Usage (WORD), UsageValue (DWORD), PreparsedData (PHIDP_PREPARSED_DATA), Report (LPSTR in/out), ReportLength (DWORD)
r1, _, err := procHidP_SetUsageValue.Call(
uintptr(ReportType),
uintptr(UsagePage),
uintptr(LinkCollection),
uintptr(Usage),
uintptr(UsageValue),
uintptr(PreparsedData),
uintptr(Report),
uintptr(ReportLength),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // NTSTATUSfunction HidP_SetUsageValue(
ReportType: Integer; // HIDP_REPORT_TYPE
UsagePage: Word; // WORD
LinkCollection: Word; // WORD optional
Usage: Word; // WORD
UsageValue: DWORD; // DWORD
PreparsedData: NativeInt; // PHIDP_PREPARSED_DATA
Report: PAnsiChar; // LPSTR in/out
ReportLength: DWORD // DWORD
): Integer; stdcall;
external 'HID.dll' name 'HidP_SetUsageValue';result := DllCall("HID\HidP_SetUsageValue"
, "Int", ReportType ; HIDP_REPORT_TYPE
, "UShort", UsagePage ; WORD
, "UShort", LinkCollection ; WORD optional
, "UShort", Usage ; WORD
, "UInt", UsageValue ; DWORD
, "Ptr", PreparsedData ; PHIDP_PREPARSED_DATA
, "Ptr", Report ; LPSTR in/out
, "UInt", ReportLength ; DWORD
, "Int") ; return: NTSTATUS●HidP_SetUsageValue(ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, Report, ReportLength) = DLL("HID.dll", "int HidP_SetUsageValue(int, int, int, int, dword, int, char*, dword)")
# 呼び出し: HidP_SetUsageValue(ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, Report, ReportLength)
# ReportType : HIDP_REPORT_TYPE -> "int"
# UsagePage : WORD -> "int"
# LinkCollection : WORD optional -> "int"
# Usage : WORD -> "int"
# UsageValue : DWORD -> "dword"
# PreparsedData : PHIDP_PREPARSED_DATA -> "int"
# Report : LPSTR in/out -> "char*"
# ReportLength : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "hid" fn HidP_SetUsageValue(
ReportType: i32, // HIDP_REPORT_TYPE
UsagePage: u16, // WORD
LinkCollection: u16, // WORD optional
Usage: u16, // WORD
UsageValue: u32, // DWORD
PreparsedData: isize, // PHIDP_PREPARSED_DATA
Report: [*c]u8, // LPSTR in/out
ReportLength: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;proc HidP_SetUsageValue(
ReportType: int32, # HIDP_REPORT_TYPE
UsagePage: uint16, # WORD
LinkCollection: uint16, # WORD optional
Usage: uint16, # WORD
UsageValue: uint32, # DWORD
PreparsedData: int, # PHIDP_PREPARSED_DATA
Report: ptr char, # LPSTR in/out
ReportLength: uint32 # DWORD
): int32 {.importc: "HidP_SetUsageValue", stdcall, dynlib: "HID.dll".}pragma(lib, "hid");
extern(Windows)
int HidP_SetUsageValue(
int ReportType, // HIDP_REPORT_TYPE
ushort UsagePage, // WORD
ushort LinkCollection, // WORD optional
ushort Usage, // WORD
uint UsageValue, // DWORD
ptrdiff_t PreparsedData, // PHIDP_PREPARSED_DATA
char* Report, // LPSTR in/out
uint ReportLength // DWORD
);ccall((:HidP_SetUsageValue, "HID.dll"), stdcall, Int32,
(Int32, UInt16, UInt16, UInt16, UInt32, Int, Ptr{UInt8}, UInt32),
ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, Report, ReportLength)
# ReportType : HIDP_REPORT_TYPE -> Int32
# UsagePage : WORD -> UInt16
# LinkCollection : WORD optional -> UInt16
# Usage : WORD -> UInt16
# UsageValue : DWORD -> UInt32
# PreparsedData : PHIDP_PREPARSED_DATA -> Int
# Report : LPSTR in/out -> Ptr{UInt8}
# ReportLength : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t HidP_SetUsageValue(
int32_t ReportType,
uint16_t UsagePage,
uint16_t LinkCollection,
uint16_t Usage,
uint32_t UsageValue,
intptr_t PreparsedData,
char* Report,
uint32_t ReportLength);
]]
local hid = ffi.load("hid")
-- hid.HidP_SetUsageValue(ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, Report, ReportLength)
-- ReportType : HIDP_REPORT_TYPE
-- UsagePage : WORD
-- LinkCollection : WORD optional
-- Usage : WORD
-- UsageValue : DWORD
-- PreparsedData : PHIDP_PREPARSED_DATA
-- Report : LPSTR in/out
-- ReportLength : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('HID.dll');
const HidP_SetUsageValue = lib.func('__stdcall', 'HidP_SetUsageValue', 'int32_t', ['int32_t', 'uint16_t', 'uint16_t', 'uint16_t', 'uint32_t', 'intptr_t', 'char *', 'uint32_t']);
// HidP_SetUsageValue(ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, Report, ReportLength)
// ReportType : HIDP_REPORT_TYPE -> 'int32_t'
// UsagePage : WORD -> 'uint16_t'
// LinkCollection : WORD optional -> 'uint16_t'
// Usage : WORD -> 'uint16_t'
// UsageValue : DWORD -> 'uint32_t'
// PreparsedData : PHIDP_PREPARSED_DATA -> 'intptr_t'
// Report : LPSTR in/out -> 'char *'
// ReportLength : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("HID.dll", {
HidP_SetUsageValue: { parameters: ["i32", "u16", "u16", "u16", "u32", "isize", "buffer", "u32"], result: "i32" },
});
// lib.symbols.HidP_SetUsageValue(ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, Report, ReportLength)
// ReportType : HIDP_REPORT_TYPE -> "i32"
// UsagePage : WORD -> "u16"
// LinkCollection : WORD optional -> "u16"
// Usage : WORD -> "u16"
// UsageValue : DWORD -> "u32"
// PreparsedData : PHIDP_PREPARSED_DATA -> "isize"
// Report : LPSTR in/out -> "buffer"
// ReportLength : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t HidP_SetUsageValue(
int32_t ReportType,
uint16_t UsagePage,
uint16_t LinkCollection,
uint16_t Usage,
uint32_t UsageValue,
intptr_t PreparsedData,
char* Report,
uint32_t ReportLength);
C, "HID.dll");
// $ffi->HidP_SetUsageValue(ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, Report, ReportLength);
// ReportType : HIDP_REPORT_TYPE
// UsagePage : WORD
// LinkCollection : WORD optional
// Usage : WORD
// UsageValue : DWORD
// PreparsedData : PHIDP_PREPARSED_DATA
// Report : LPSTR in/out
// ReportLength : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Hid extends StdCallLibrary {
Hid INSTANCE = Native.load("hid", Hid.class);
int HidP_SetUsageValue(
int ReportType, // HIDP_REPORT_TYPE
short UsagePage, // WORD
short LinkCollection, // WORD optional
short Usage, // WORD
int UsageValue, // DWORD
long PreparsedData, // PHIDP_PREPARSED_DATA
byte[] Report, // LPSTR in/out
int ReportLength // DWORD
);
}@[Link("hid")]
lib LibHID
fun HidP_SetUsageValue = HidP_SetUsageValue(
ReportType : Int32, # HIDP_REPORT_TYPE
UsagePage : UInt16, # WORD
LinkCollection : UInt16, # WORD optional
Usage : UInt16, # WORD
UsageValue : UInt32, # DWORD
PreparsedData : LibC::SSizeT, # PHIDP_PREPARSED_DATA
Report : UInt8*, # LPSTR in/out
ReportLength : UInt32 # DWORD
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef HidP_SetUsageValueNative = Int32 Function(Int32, Uint16, Uint16, Uint16, Uint32, IntPtr, Pointer<Utf8>, Uint32);
typedef HidP_SetUsageValueDart = int Function(int, int, int, int, int, int, Pointer<Utf8>, int);
final HidP_SetUsageValue = DynamicLibrary.open('HID.dll')
.lookupFunction<HidP_SetUsageValueNative, HidP_SetUsageValueDart>('HidP_SetUsageValue');
// ReportType : HIDP_REPORT_TYPE -> Int32
// UsagePage : WORD -> Uint16
// LinkCollection : WORD optional -> Uint16
// Usage : WORD -> Uint16
// UsageValue : DWORD -> Uint32
// PreparsedData : PHIDP_PREPARSED_DATA -> IntPtr
// Report : LPSTR in/out -> Pointer<Utf8>
// ReportLength : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function HidP_SetUsageValue(
ReportType: Integer; // HIDP_REPORT_TYPE
UsagePage: Word; // WORD
LinkCollection: Word; // WORD optional
Usage: Word; // WORD
UsageValue: DWORD; // DWORD
PreparsedData: NativeInt; // PHIDP_PREPARSED_DATA
Report: PAnsiChar; // LPSTR in/out
ReportLength: DWORD // DWORD
): Integer; stdcall;
external 'HID.dll' name 'HidP_SetUsageValue';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "HidP_SetUsageValue"
c_HidP_SetUsageValue :: Int32 -> Word16 -> Word16 -> Word16 -> Word32 -> CIntPtr -> CString -> Word32 -> IO Int32
-- ReportType : HIDP_REPORT_TYPE -> Int32
-- UsagePage : WORD -> Word16
-- LinkCollection : WORD optional -> Word16
-- Usage : WORD -> Word16
-- UsageValue : DWORD -> Word32
-- PreparsedData : PHIDP_PREPARSED_DATA -> CIntPtr
-- Report : LPSTR in/out -> CString
-- ReportLength : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let hidp_setusagevalue =
foreign "HidP_SetUsageValue"
(int32_t @-> uint16_t @-> uint16_t @-> uint16_t @-> uint32_t @-> intptr_t @-> string @-> uint32_t @-> returning int32_t)
(* ReportType : HIDP_REPORT_TYPE -> int32_t *)
(* UsagePage : WORD -> uint16_t *)
(* LinkCollection : WORD optional -> uint16_t *)
(* Usage : WORD -> uint16_t *)
(* UsageValue : DWORD -> uint32_t *)
(* PreparsedData : PHIDP_PREPARSED_DATA -> intptr_t *)
(* Report : LPSTR in/out -> string *)
(* ReportLength : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library hid (t "HID.dll"))
(cffi:use-foreign-library hid)
(cffi:defcfun ("HidP_SetUsageValue" hid-p-set-usage-value :convention :stdcall) :int32
(report-type :int32) ; HIDP_REPORT_TYPE
(usage-page :uint16) ; WORD
(link-collection :uint16) ; WORD optional
(usage :uint16) ; WORD
(usage-value :uint32) ; DWORD
(preparsed-data :int64) ; PHIDP_PREPARSED_DATA
(report :pointer) ; LPSTR in/out
(report-length :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $HidP_SetUsageValue = Win32::API::More->new('HID',
'int HidP_SetUsageValue(int ReportType, WORD UsagePage, WORD LinkCollection, WORD Usage, DWORD UsageValue, LPARAM PreparsedData, LPSTR Report, DWORD ReportLength)');
# my $ret = $HidP_SetUsageValue->Call($ReportType, $UsagePage, $LinkCollection, $Usage, $UsageValue, $PreparsedData, $Report, $ReportLength);
# ReportType : HIDP_REPORT_TYPE -> int
# UsagePage : WORD -> WORD
# LinkCollection : WORD optional -> WORD
# Usage : WORD -> WORD
# UsageValue : DWORD -> DWORD
# PreparsedData : PHIDP_PREPARSED_DATA -> LPARAM
# Report : LPSTR in/out -> LPSTR
# ReportLength : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型