ホーム › UI.Accessibility › ValuePattern_SetValue
ValuePattern_SetValue
関数Valueパターンで要素の文字列値を設定する。
シグネチャ
// UIAutomationCore.dll
#include <windows.h>
HRESULT ValuePattern_SetValue(
HUIAPATTERNOBJECT hobj,
LPCWSTR pVal
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hobj | HUIAPATTERNOBJECT | in |
| pVal | LPCWSTR | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// UIAutomationCore.dll
#include <windows.h>
HRESULT ValuePattern_SetValue(
HUIAPATTERNOBJECT hobj,
LPCWSTR pVal
);[DllImport("UIAutomationCore.dll", ExactSpelling = true)]
static extern int ValuePattern_SetValue(
IntPtr hobj, // HUIAPATTERNOBJECT
[MarshalAs(UnmanagedType.LPWStr)] string pVal // LPCWSTR
);<DllImport("UIAutomationCore.dll", ExactSpelling:=True)>
Public Shared Function ValuePattern_SetValue(
hobj As IntPtr, ' HUIAPATTERNOBJECT
<MarshalAs(UnmanagedType.LPWStr)> pVal As String ' LPCWSTR
) As Integer
End Function' hobj : HUIAPATTERNOBJECT
' pVal : LPCWSTR
Declare PtrSafe Function ValuePattern_SetValue Lib "uiautomationcore" ( _
ByVal hobj As LongPtr, _
ByVal pVal As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ValuePattern_SetValue = ctypes.windll.uiautomationcore.ValuePattern_SetValue
ValuePattern_SetValue.restype = ctypes.c_int
ValuePattern_SetValue.argtypes = [
wintypes.HANDLE, # hobj : HUIAPATTERNOBJECT
wintypes.LPCWSTR, # pVal : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('UIAutomationCore.dll')
ValuePattern_SetValue = Fiddle::Function.new(
lib['ValuePattern_SetValue'],
[
Fiddle::TYPE_VOIDP, # hobj : HUIAPATTERNOBJECT
Fiddle::TYPE_VOIDP, # pVal : LPCWSTR
],
Fiddle::TYPE_INT)#[link(name = "uiautomationcore")]
extern "system" {
fn ValuePattern_SetValue(
hobj: *mut core::ffi::c_void, // HUIAPATTERNOBJECT
pVal: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("UIAutomationCore.dll")]
public static extern int ValuePattern_SetValue(IntPtr hobj, [MarshalAs(UnmanagedType.LPWStr)] string pVal);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UIAutomationCore_ValuePattern_SetValue' -Namespace Win32 -PassThru
# $api::ValuePattern_SetValue(hobj, pVal)#uselib "UIAutomationCore.dll"
#func global ValuePattern_SetValue "ValuePattern_SetValue" sptr, sptr
; ValuePattern_SetValue hobj, pVal ; 戻り値は stat
; hobj : HUIAPATTERNOBJECT -> "sptr"
; pVal : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "UIAutomationCore.dll"
#cfunc global ValuePattern_SetValue "ValuePattern_SetValue" sptr, wstr
; res = ValuePattern_SetValue(hobj, pVal)
; hobj : HUIAPATTERNOBJECT -> "sptr"
; pVal : LPCWSTR -> "wstr"; HRESULT ValuePattern_SetValue(HUIAPATTERNOBJECT hobj, LPCWSTR pVal)
#uselib "UIAutomationCore.dll"
#cfunc global ValuePattern_SetValue "ValuePattern_SetValue" intptr, wstr
; res = ValuePattern_SetValue(hobj, pVal)
; hobj : HUIAPATTERNOBJECT -> "intptr"
; pVal : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
procValuePattern_SetValue = uiautomationcore.NewProc("ValuePattern_SetValue")
)
// hobj (HUIAPATTERNOBJECT), pVal (LPCWSTR)
r1, _, err := procValuePattern_SetValue.Call(
uintptr(hobj),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pVal))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction ValuePattern_SetValue(
hobj: THandle; // HUIAPATTERNOBJECT
pVal: PWideChar // LPCWSTR
): Integer; stdcall;
external 'UIAutomationCore.dll' name 'ValuePattern_SetValue';result := DllCall("UIAutomationCore\ValuePattern_SetValue"
, "Ptr", hobj ; HUIAPATTERNOBJECT
, "WStr", pVal ; LPCWSTR
, "Int") ; return: HRESULT●ValuePattern_SetValue(hobj, pVal) = DLL("UIAutomationCore.dll", "int ValuePattern_SetValue(void*, char*)")
# 呼び出し: ValuePattern_SetValue(hobj, pVal)
# hobj : HUIAPATTERNOBJECT -> "void*"
# pVal : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。