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