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

InheritWindowMonitor

関数
ウィンドウの表示モニタを別ウィンドウから継承させる。
DLLUSER32.dll呼出規約winapi

シグネチャ

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

BOOL InheritWindowMonitor(
    HWND hwnd,
    HWND hwndInherit   // optional
);

パラメーター

名前方向
hwndHWNDin
hwndInheritHWNDinoptional

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL InheritWindowMonitor(
    HWND hwnd,
    HWND hwndInherit   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", ExactSpelling = true)]
static extern bool InheritWindowMonitor(
    IntPtr hwnd,   // HWND
    IntPtr hwndInherit   // HWND optional
);
<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function InheritWindowMonitor(
    hwnd As IntPtr,   ' HWND
    hwndInherit As IntPtr   ' HWND optional
) As Boolean
End Function
' hwnd : HWND
' hwndInherit : HWND optional
Declare PtrSafe Function InheritWindowMonitor Lib "user32" ( _
    ByVal hwnd As LongPtr, _
    ByVal hwndInherit As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

InheritWindowMonitor = ctypes.windll.user32.InheritWindowMonitor
InheritWindowMonitor.restype = wintypes.BOOL
InheritWindowMonitor.argtypes = [
    wintypes.HANDLE,  # hwnd : HWND
    wintypes.HANDLE,  # hwndInherit : HWND optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procInheritWindowMonitor = user32.NewProc("InheritWindowMonitor")
)

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