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