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

WindowPattern_Close

関数
Windowパターンで対象ウィンドウを閉じる。
DLLUIAutomationCore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT WindowPattern_Close(
    HUIAPATTERNOBJECT hobj
);

パラメーター

名前方向
hobjHUIAPATTERNOBJECTin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WindowPattern_Close(
    HUIAPATTERNOBJECT hobj
);
[DllImport("UIAutomationCore.dll", ExactSpelling = true)]
static extern int WindowPattern_Close(
    IntPtr hobj   // HUIAPATTERNOBJECT
);
<DllImport("UIAutomationCore.dll", ExactSpelling:=True)>
Public Shared Function WindowPattern_Close(
    hobj As IntPtr   ' HUIAPATTERNOBJECT
) As Integer
End Function
' hobj : HUIAPATTERNOBJECT
Declare PtrSafe Function WindowPattern_Close Lib "uiautomationcore" ( _
    ByVal hobj As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WindowPattern_Close = ctypes.windll.uiautomationcore.WindowPattern_Close
WindowPattern_Close.restype = ctypes.c_int
WindowPattern_Close.argtypes = [
    wintypes.HANDLE,  # hobj : HUIAPATTERNOBJECT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
	procWindowPattern_Close = uiautomationcore.NewProc("WindowPattern_Close")
)

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