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