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

IsHungAppWindow

関数
指定ウィンドウが応答停止状態か判定する。
DLLUSER32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

BOOL IsHungAppWindow(
    HWND hwnd
);

パラメーター

名前方向
hwndHWNDin

戻り値の型: BOOL

各言語での呼び出し定義

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

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

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

lib = Fiddle.dlopen('USER32.dll')
IsHungAppWindow = Fiddle::Function.new(
  lib['IsHungAppWindow'],
  [
    Fiddle::TYPE_VOIDP,  # hwnd : HWND
  ],
  Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn IsHungAppWindow(
        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 IsHungAppWindow(IntPtr hwnd);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_IsHungAppWindow' -Namespace Win32 -PassThru
# $api::IsHungAppWindow(hwnd)
#uselib "USER32.dll"
#func global IsHungAppWindow "IsHungAppWindow" sptr
; IsHungAppWindow hwnd   ; 戻り値は stat
; hwnd : HWND -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "USER32.dll"
#cfunc global IsHungAppWindow "IsHungAppWindow" sptr
; res = IsHungAppWindow(hwnd)
; hwnd : HWND -> "sptr"
; BOOL IsHungAppWindow(HWND hwnd)
#uselib "USER32.dll"
#cfunc global IsHungAppWindow "IsHungAppWindow" intptr
; res = IsHungAppWindow(hwnd)
; hwnd : HWND -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procIsHungAppWindow = user32.NewProc("IsHungAppWindow")
)

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