Win32 API 日本語リファレンス
ホームUI.Accessibility › UiaLookupId

UiaLookupId

関数
プロパティやパターンのGUIDから整数IDを検索する。
DLLUIAutomationCore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

// UIAutomationCore.dll
#include <windows.h>

INT UiaLookupId(
    AutomationIdentifierType type,
    const GUID* pGuid
);

パラメーター

名前方向
typeAutomationIdentifierTypein
pGuidGUID*in

戻り値の型: INT

各言語での呼び出し定義

// UIAutomationCore.dll
#include <windows.h>

INT UiaLookupId(
    AutomationIdentifierType type,
    const GUID* pGuid
);
[DllImport("UIAutomationCore.dll", ExactSpelling = true)]
static extern int UiaLookupId(
    int type,   // AutomationIdentifierType
    ref Guid pGuid   // GUID*
);
<DllImport("UIAutomationCore.dll", ExactSpelling:=True)>
Public Shared Function UiaLookupId(
    type As Integer,   ' AutomationIdentifierType
    ByRef pGuid As Guid   ' GUID*
) As Integer
End Function
' type : AutomationIdentifierType
' pGuid : GUID*
Declare PtrSafe Function UiaLookupId Lib "uiautomationcore" ( _
    ByVal type As Long, _
    ByVal pGuid As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

UiaLookupId = ctypes.windll.uiautomationcore.UiaLookupId
UiaLookupId.restype = ctypes.c_int
UiaLookupId.argtypes = [
    ctypes.c_int,  # type : AutomationIdentifierType
    ctypes.c_void_p,  # pGuid : GUID*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('UIAutomationCore.dll')
UiaLookupId = Fiddle::Function.new(
  lib['UiaLookupId'],
  [
    Fiddle::TYPE_INT,  # type : AutomationIdentifierType
    Fiddle::TYPE_VOIDP,  # pGuid : GUID*
  ],
  Fiddle::TYPE_INT)
#[link(name = "uiautomationcore")]
extern "system" {
    fn UiaLookupId(
        type: i32,  // AutomationIdentifierType
        pGuid: *const GUID  // GUID*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("UIAutomationCore.dll")]
public static extern int UiaLookupId(int type, ref Guid pGuid);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UIAutomationCore_UiaLookupId' -Namespace Win32 -PassThru
# $api::UiaLookupId(type, pGuid)
#uselib "UIAutomationCore.dll"
#func global UiaLookupId "UiaLookupId" sptr, sptr
; UiaLookupId type, varptr(pGuid)   ; 戻り値は stat
; type : AutomationIdentifierType -> "sptr"
; pGuid : GUID* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "UIAutomationCore.dll"
#cfunc global UiaLookupId "UiaLookupId" int, var
; res = UiaLookupId(type, pGuid)
; type : AutomationIdentifierType -> "int"
; pGuid : GUID* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT UiaLookupId(AutomationIdentifierType type, GUID* pGuid)
#uselib "UIAutomationCore.dll"
#cfunc global UiaLookupId "UiaLookupId" int, var
; res = UiaLookupId(type, pGuid)
; type : AutomationIdentifierType -> "int"
; pGuid : GUID* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
	procUiaLookupId = uiautomationcore.NewProc("UiaLookupId")
)

// type (AutomationIdentifierType), pGuid (GUID*)
r1, _, err := procUiaLookupId.Call(
	uintptr(type),
	uintptr(pGuid),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function UiaLookupId(
  type: Integer;   // AutomationIdentifierType
  pGuid: PGUID   // GUID*
): Integer; stdcall;
  external 'UIAutomationCore.dll' name 'UiaLookupId';
result := DllCall("UIAutomationCore\UiaLookupId"
    , "Int", type   ; AutomationIdentifierType
    , "Ptr", pGuid   ; GUID*
    , "Int")   ; return: INT
●UiaLookupId(type, pGuid) = DLL("UIAutomationCore.dll", "int UiaLookupId(int, void*)")
# 呼び出し: UiaLookupId(type, pGuid)
# type : AutomationIdentifierType -> "int"
# pGuid : GUID* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。