Win32 API 日本語リファレンス
ホームDevices.Sensors › PropKeyFindKeyGetNthUshort

PropKeyFindKeyGetNthUshort

関数
コレクションリストから指定キーのN番目のUSHORT値を取得する。
DLLSensorsUtilsV2.dll呼出規約winapi

シグネチャ

// SensorsUtilsV2.dll
#include <windows.h>

NTSTATUS PropKeyFindKeyGetNthUshort(
    const SENSOR_COLLECTION_LIST* pList,
    const PROPERTYKEY* pKey,
    DWORD Occurrence,
    WORD* pRetValue
);

パラメーター

名前方向
pListSENSOR_COLLECTION_LIST*in
pKeyPROPERTYKEY*in
OccurrenceDWORDin
pRetValueWORD*out

戻り値の型: NTSTATUS

各言語での呼び出し定義

// SensorsUtilsV2.dll
#include <windows.h>

NTSTATUS PropKeyFindKeyGetNthUshort(
    const SENSOR_COLLECTION_LIST* pList,
    const PROPERTYKEY* pKey,
    DWORD Occurrence,
    WORD* pRetValue
);
[DllImport("SensorsUtilsV2.dll", ExactSpelling = true)]
static extern int PropKeyFindKeyGetNthUshort(
    IntPtr pList,   // SENSOR_COLLECTION_LIST*
    IntPtr pKey,   // PROPERTYKEY*
    uint Occurrence,   // DWORD
    out ushort pRetValue   // WORD* out
);
<DllImport("SensorsUtilsV2.dll", ExactSpelling:=True)>
Public Shared Function PropKeyFindKeyGetNthUshort(
    pList As IntPtr,   ' SENSOR_COLLECTION_LIST*
    pKey As IntPtr,   ' PROPERTYKEY*
    Occurrence As UInteger,   ' DWORD
    <Out> ByRef pRetValue As UShort   ' WORD* out
) As Integer
End Function
' pList : SENSOR_COLLECTION_LIST*
' pKey : PROPERTYKEY*
' Occurrence : DWORD
' pRetValue : WORD* out
Declare PtrSafe Function PropKeyFindKeyGetNthUshort Lib "sensorsutilsv2" ( _
    ByVal pList As LongPtr, _
    ByVal pKey As LongPtr, _
    ByVal Occurrence As Long, _
    ByRef pRetValue As Integer) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PropKeyFindKeyGetNthUshort = ctypes.windll.sensorsutilsv2.PropKeyFindKeyGetNthUshort
PropKeyFindKeyGetNthUshort.restype = ctypes.c_int
PropKeyFindKeyGetNthUshort.argtypes = [
    ctypes.c_void_p,  # pList : SENSOR_COLLECTION_LIST*
    ctypes.c_void_p,  # pKey : PROPERTYKEY*
    wintypes.DWORD,  # Occurrence : DWORD
    ctypes.POINTER(ctypes.c_ushort),  # pRetValue : WORD* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SensorsUtilsV2.dll')
PropKeyFindKeyGetNthUshort = Fiddle::Function.new(
  lib['PropKeyFindKeyGetNthUshort'],
  [
    Fiddle::TYPE_VOIDP,  # pList : SENSOR_COLLECTION_LIST*
    Fiddle::TYPE_VOIDP,  # pKey : PROPERTYKEY*
    -Fiddle::TYPE_INT,  # Occurrence : DWORD
    Fiddle::TYPE_VOIDP,  # pRetValue : WORD* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "sensorsutilsv2")]
extern "system" {
    fn PropKeyFindKeyGetNthUshort(
        pList: *const SENSOR_COLLECTION_LIST,  // SENSOR_COLLECTION_LIST*
        pKey: *const PROPERTYKEY,  // PROPERTYKEY*
        Occurrence: u32,  // DWORD
        pRetValue: *mut u16  // WORD* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SensorsUtilsV2.dll")]
public static extern int PropKeyFindKeyGetNthUshort(IntPtr pList, IntPtr pKey, uint Occurrence, out ushort pRetValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SensorsUtilsV2_PropKeyFindKeyGetNthUshort' -Namespace Win32 -PassThru
# $api::PropKeyFindKeyGetNthUshort(pList, pKey, Occurrence, pRetValue)
#uselib "SensorsUtilsV2.dll"
#func global PropKeyFindKeyGetNthUshort "PropKeyFindKeyGetNthUshort" sptr, sptr, sptr, sptr
; PropKeyFindKeyGetNthUshort varptr(pList), varptr(pKey), Occurrence, varptr(pRetValue)   ; 戻り値は stat
; pList : SENSOR_COLLECTION_LIST* -> "sptr"
; pKey : PROPERTYKEY* -> "sptr"
; Occurrence : DWORD -> "sptr"
; pRetValue : WORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "SensorsUtilsV2.dll"
#cfunc global PropKeyFindKeyGetNthUshort "PropKeyFindKeyGetNthUshort" var, var, int, var
; res = PropKeyFindKeyGetNthUshort(pList, pKey, Occurrence, pRetValue)
; pList : SENSOR_COLLECTION_LIST* -> "var"
; pKey : PROPERTYKEY* -> "var"
; Occurrence : DWORD -> "int"
; pRetValue : WORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; NTSTATUS PropKeyFindKeyGetNthUshort(SENSOR_COLLECTION_LIST* pList, PROPERTYKEY* pKey, DWORD Occurrence, WORD* pRetValue)
#uselib "SensorsUtilsV2.dll"
#cfunc global PropKeyFindKeyGetNthUshort "PropKeyFindKeyGetNthUshort" var, var, int, var
; res = PropKeyFindKeyGetNthUshort(pList, pKey, Occurrence, pRetValue)
; pList : SENSOR_COLLECTION_LIST* -> "var"
; pKey : PROPERTYKEY* -> "var"
; Occurrence : DWORD -> "int"
; pRetValue : WORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	sensorsutilsv2 = windows.NewLazySystemDLL("SensorsUtilsV2.dll")
	procPropKeyFindKeyGetNthUshort = sensorsutilsv2.NewProc("PropKeyFindKeyGetNthUshort")
)

// pList (SENSOR_COLLECTION_LIST*), pKey (PROPERTYKEY*), Occurrence (DWORD), pRetValue (WORD* out)
r1, _, err := procPropKeyFindKeyGetNthUshort.Call(
	uintptr(pList),
	uintptr(pKey),
	uintptr(Occurrence),
	uintptr(pRetValue),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // NTSTATUS
function PropKeyFindKeyGetNthUshort(
  pList: Pointer;   // SENSOR_COLLECTION_LIST*
  pKey: Pointer;   // PROPERTYKEY*
  Occurrence: DWORD;   // DWORD
  pRetValue: Pointer   // WORD* out
): Integer; stdcall;
  external 'SensorsUtilsV2.dll' name 'PropKeyFindKeyGetNthUshort';
result := DllCall("SensorsUtilsV2\PropKeyFindKeyGetNthUshort"
    , "Ptr", pList   ; SENSOR_COLLECTION_LIST*
    , "Ptr", pKey   ; PROPERTYKEY*
    , "UInt", Occurrence   ; DWORD
    , "Ptr", pRetValue   ; WORD* out
    , "Int")   ; return: NTSTATUS
●PropKeyFindKeyGetNthUshort(pList, pKey, Occurrence, pRetValue) = DLL("SensorsUtilsV2.dll", "int PropKeyFindKeyGetNthUshort(void*, void*, dword, void*)")
# 呼び出し: PropKeyFindKeyGetNthUshort(pList, pKey, Occurrence, pRetValue)
# pList : SENSOR_COLLECTION_LIST* -> "void*"
# pKey : PROPERTYKEY* -> "void*"
# Occurrence : DWORD -> "dword"
# pRetValue : WORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。