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

WindowPattern_SetWindowVisualState

関数
Windowパターンでウィンドウの最大化・最小化状態を設定する。
DLLUIAutomationCore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT WindowPattern_SetWindowVisualState(
    HUIAPATTERNOBJECT hobj,
    WindowVisualState state
);

パラメーター

名前方向
hobjHUIAPATTERNOBJECTin
stateWindowVisualStatein

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

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

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

var (
	uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
	procWindowPattern_SetWindowVisualState = uiautomationcore.NewProc("WindowPattern_SetWindowVisualState")
)

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