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