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

WindowFromAccessibleObject

関数
アクセシブルオブジェクトに対応するウィンドウハンドルを取得する。
DLLOLEACC.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

HRESULT WindowFromAccessibleObject(
    IAccessible* param0,
    HWND* phwnd   // optional
);

パラメーター

名前方向
param0IAccessible*in
phwndHWND*outoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WindowFromAccessibleObject(
    IAccessible* param0,
    HWND* phwnd   // optional
);
[DllImport("OLEACC.dll", ExactSpelling = true)]
static extern int WindowFromAccessibleObject(
    IntPtr param0,   // IAccessible*
    IntPtr phwnd   // HWND* optional, out
);
<DllImport("OLEACC.dll", ExactSpelling:=True)>
Public Shared Function WindowFromAccessibleObject(
    param0 As IntPtr,   ' IAccessible*
    phwnd As IntPtr   ' HWND* optional, out
) As Integer
End Function
' param0 : IAccessible*
' phwnd : HWND* optional, out
Declare PtrSafe Function WindowFromAccessibleObject Lib "oleacc" ( _
    ByVal param0 As LongPtr, _
    ByVal phwnd As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WindowFromAccessibleObject = ctypes.windll.oleacc.WindowFromAccessibleObject
WindowFromAccessibleObject.restype = ctypes.c_int
WindowFromAccessibleObject.argtypes = [
    ctypes.c_void_p,  # param0 : IAccessible*
    ctypes.c_void_p,  # phwnd : HWND* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OLEACC.dll')
WindowFromAccessibleObject = Fiddle::Function.new(
  lib['WindowFromAccessibleObject'],
  [
    Fiddle::TYPE_VOIDP,  # param0 : IAccessible*
    Fiddle::TYPE_VOIDP,  # phwnd : HWND* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "oleacc")]
extern "system" {
    fn WindowFromAccessibleObject(
        param0: *mut core::ffi::c_void,  // IAccessible*
        phwnd: *mut *mut core::ffi::c_void  // HWND* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("OLEACC.dll")]
public static extern int WindowFromAccessibleObject(IntPtr param0, IntPtr phwnd);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLEACC_WindowFromAccessibleObject' -Namespace Win32 -PassThru
# $api::WindowFromAccessibleObject(param0, phwnd)
#uselib "OLEACC.dll"
#func global WindowFromAccessibleObject "WindowFromAccessibleObject" sptr, sptr
; WindowFromAccessibleObject param0, phwnd   ; 戻り値は stat
; param0 : IAccessible* -> "sptr"
; phwnd : HWND* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "OLEACC.dll"
#cfunc global WindowFromAccessibleObject "WindowFromAccessibleObject" sptr, sptr
; res = WindowFromAccessibleObject(param0, phwnd)
; param0 : IAccessible* -> "sptr"
; phwnd : HWND* optional, out -> "sptr"
; HRESULT WindowFromAccessibleObject(IAccessible* param0, HWND* phwnd)
#uselib "OLEACC.dll"
#cfunc global WindowFromAccessibleObject "WindowFromAccessibleObject" intptr, intptr
; res = WindowFromAccessibleObject(param0, phwnd)
; param0 : IAccessible* -> "intptr"
; phwnd : HWND* optional, out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	oleacc = windows.NewLazySystemDLL("OLEACC.dll")
	procWindowFromAccessibleObject = oleacc.NewProc("WindowFromAccessibleObject")
)

// param0 (IAccessible*), phwnd (HWND* optional, out)
r1, _, err := procWindowFromAccessibleObject.Call(
	uintptr(param0),
	uintptr(phwnd),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WindowFromAccessibleObject(
  param0: Pointer;   // IAccessible*
  phwnd: Pointer   // HWND* optional, out
): Integer; stdcall;
  external 'OLEACC.dll' name 'WindowFromAccessibleObject';
result := DllCall("OLEACC\WindowFromAccessibleObject"
    , "Ptr", param0   ; IAccessible*
    , "Ptr", phwnd   ; HWND* optional, out
    , "Int")   ; return: HRESULT
●WindowFromAccessibleObject(param0, phwnd) = DLL("OLEACC.dll", "int WindowFromAccessibleObject(void*, void*)")
# 呼び出し: WindowFromAccessibleObject(param0, phwnd)
# param0 : IAccessible* -> "void*"
# phwnd : HWND* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。