ホーム › UI.WindowsAndMessaging › GetPropW
GetPropW
関数ウィンドウのプロパティリストからデータを取得する(Unicode版)。
シグネチャ
// USER32.dll (Unicode / -W)
#include <windows.h>
HANDLE GetPropW(
HWND hWnd,
LPCWSTR lpString
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hWnd | HWND | in |
| lpString | LPCWSTR | in |
戻り値の型: HANDLE
各言語での呼び出し定義
// USER32.dll (Unicode / -W)
#include <windows.h>
HANDLE GetPropW(
HWND hWnd,
LPCWSTR lpString
);[DllImport("USER32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern IntPtr GetPropW(
IntPtr hWnd, // HWND
[MarshalAs(UnmanagedType.LPWStr)] string lpString // LPCWSTR
);<DllImport("USER32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function GetPropW(
hWnd As IntPtr, ' HWND
<MarshalAs(UnmanagedType.LPWStr)> lpString As String ' LPCWSTR
) As IntPtr
End Function' hWnd : HWND
' lpString : LPCWSTR
Declare PtrSafe Function GetPropW Lib "user32" ( _
ByVal hWnd As LongPtr, _
ByVal lpString As LongPtr) As LongPtr
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetPropW = ctypes.windll.user32.GetPropW
GetPropW.restype = ctypes.c_void_p
GetPropW.argtypes = [
wintypes.HANDLE, # hWnd : HWND
wintypes.LPCWSTR, # lpString : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
GetPropW = Fiddle::Function.new(
lib['GetPropW'],
[
Fiddle::TYPE_VOIDP, # hWnd : HWND
Fiddle::TYPE_VOIDP, # lpString : LPCWSTR
],
Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "user32")]
extern "system" {
fn GetPropW(
hWnd: *mut core::ffi::c_void, // HWND
lpString: *const u16 // LPCWSTR
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USER32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr GetPropW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] string lpString);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_GetPropW' -Namespace Win32 -PassThru
# $api::GetPropW(hWnd, lpString)#uselib "USER32.dll"
#func global GetPropW "GetPropW" wptr, wptr
; GetPropW hWnd, lpString ; 戻り値は stat
; hWnd : HWND -> "wptr"
; lpString : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global GetPropW "GetPropW" sptr, wstr
; res = GetPropW(hWnd, lpString)
; hWnd : HWND -> "sptr"
; lpString : LPCWSTR -> "wstr"; HANDLE GetPropW(HWND hWnd, LPCWSTR lpString)
#uselib "USER32.dll"
#cfunc global GetPropW "GetPropW" intptr, wstr
; res = GetPropW(hWnd, lpString)
; hWnd : HWND -> "intptr"
; lpString : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procGetPropW = user32.NewProc("GetPropW")
)
// hWnd (HWND), lpString (LPCWSTR)
r1, _, err := procGetPropW.Call(
uintptr(hWnd),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpString))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HANDLEfunction GetPropW(
hWnd: THandle; // HWND
lpString: PWideChar // LPCWSTR
): THandle; stdcall;
external 'USER32.dll' name 'GetPropW';result := DllCall("USER32\GetPropW"
, "Ptr", hWnd ; HWND
, "WStr", lpString ; LPCWSTR
, "Ptr") ; return: HANDLE●GetPropW(hWnd, lpString) = DLL("USER32.dll", "void* GetPropW(void*, char*)")
# 呼び出し: GetPropW(hWnd, lpString)
# hWnd : HWND -> "void*"
# lpString : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。