ホーム › UI.WindowsAndMessaging › ApplyWindowAction
ApplyWindowAction
関数指定したウィンドウアクションを適用する。
シグネチャ
// USER32.dll
#include <windows.h>
BOOL ApplyWindowAction(
HWND hwnd,
WINDOW_ACTION* pAction
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwnd | HWND | in |
| pAction | WINDOW_ACTION* | inout |
戻り値の型: BOOL
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
BOOL ApplyWindowAction(
HWND hwnd,
WINDOW_ACTION* pAction
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", ExactSpelling = true)]
static extern bool ApplyWindowAction(
IntPtr hwnd, // HWND
IntPtr pAction // WINDOW_ACTION* in/out
);<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function ApplyWindowAction(
hwnd As IntPtr, ' HWND
pAction As IntPtr ' WINDOW_ACTION* in/out
) As Boolean
End Function' hwnd : HWND
' pAction : WINDOW_ACTION* in/out
Declare PtrSafe Function ApplyWindowAction Lib "user32" ( _
ByVal hwnd As LongPtr, _
ByVal pAction As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ApplyWindowAction = ctypes.windll.user32.ApplyWindowAction
ApplyWindowAction.restype = wintypes.BOOL
ApplyWindowAction.argtypes = [
wintypes.HANDLE, # hwnd : HWND
ctypes.c_void_p, # pAction : WINDOW_ACTION* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
ApplyWindowAction = Fiddle::Function.new(
lib['ApplyWindowAction'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
Fiddle::TYPE_VOIDP, # pAction : WINDOW_ACTION* in/out
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn ApplyWindowAction(
hwnd: *mut core::ffi::c_void, // HWND
pAction: *mut WINDOW_ACTION // WINDOW_ACTION* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll")]
public static extern bool ApplyWindowAction(IntPtr hwnd, IntPtr pAction);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_ApplyWindowAction' -Namespace Win32 -PassThru
# $api::ApplyWindowAction(hwnd, pAction)#uselib "USER32.dll"
#func global ApplyWindowAction "ApplyWindowAction" sptr, sptr
; ApplyWindowAction hwnd, varptr(pAction) ; 戻り値は stat
; hwnd : HWND -> "sptr"
; pAction : WINDOW_ACTION* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USER32.dll" #cfunc global ApplyWindowAction "ApplyWindowAction" sptr, var ; res = ApplyWindowAction(hwnd, pAction) ; hwnd : HWND -> "sptr" ; pAction : WINDOW_ACTION* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USER32.dll" #cfunc global ApplyWindowAction "ApplyWindowAction" sptr, sptr ; res = ApplyWindowAction(hwnd, varptr(pAction)) ; hwnd : HWND -> "sptr" ; pAction : WINDOW_ACTION* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL ApplyWindowAction(HWND hwnd, WINDOW_ACTION* pAction) #uselib "USER32.dll" #cfunc global ApplyWindowAction "ApplyWindowAction" intptr, var ; res = ApplyWindowAction(hwnd, pAction) ; hwnd : HWND -> "intptr" ; pAction : WINDOW_ACTION* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL ApplyWindowAction(HWND hwnd, WINDOW_ACTION* pAction) #uselib "USER32.dll" #cfunc global ApplyWindowAction "ApplyWindowAction" intptr, intptr ; res = ApplyWindowAction(hwnd, varptr(pAction)) ; hwnd : HWND -> "intptr" ; pAction : WINDOW_ACTION* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procApplyWindowAction = user32.NewProc("ApplyWindowAction")
)
// hwnd (HWND), pAction (WINDOW_ACTION* in/out)
r1, _, err := procApplyWindowAction.Call(
uintptr(hwnd),
uintptr(pAction),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction ApplyWindowAction(
hwnd: THandle; // HWND
pAction: Pointer // WINDOW_ACTION* in/out
): BOOL; stdcall;
external 'USER32.dll' name 'ApplyWindowAction';result := DllCall("USER32\ApplyWindowAction"
, "Ptr", hwnd ; HWND
, "Ptr", pAction ; WINDOW_ACTION* in/out
, "Int") ; return: BOOL●ApplyWindowAction(hwnd, pAction) = DLL("USER32.dll", "bool ApplyWindowAction(void*, void*)")
# 呼び出し: ApplyWindowAction(hwnd, pAction)
# hwnd : HWND -> "void*"
# pAction : WINDOW_ACTION* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。