Win32 API 日本語リファレンス
ホームSystem.WindowsProgramming › WinWatchDidStatusChange

WinWatchDidStatusChange

関数
監視中ウィンドウの状態が変化したかを判定する。
DLLDCIMAN32.dll呼出規約winapi

シグネチャ

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

BOOL WinWatchDidStatusChange(
    HWINWATCH hWW
);

パラメーター

名前方向説明
hWWHWINWATCHin状態変化を確認する対象の監視ハンドル(HWINWATCH)。

戻り値の型: BOOL

各言語での呼び出し定義

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

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

WinWatchDidStatusChange = ctypes.windll.dciman32.WinWatchDidStatusChange
WinWatchDidStatusChange.restype = wintypes.BOOL
WinWatchDidStatusChange.argtypes = [
    wintypes.HANDLE,  # hWW : HWINWATCH
]
require 'fiddle'
require 'fiddle/import'

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

var (
	dciman32 = windows.NewLazySystemDLL("DCIMAN32.dll")
	procWinWatchDidStatusChange = dciman32.NewProc("WinWatchDidStatusChange")
)

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

extern "dciman32" fn WinWatchDidStatusChange(
    hWW: ?*anyopaque // HWINWATCH
) callconv(std.os.windows.WINAPI) i32;
proc WinWatchDidStatusChange(
    hWW: pointer  # HWINWATCH
): int32 {.importc: "WinWatchDidStatusChange", stdcall, dynlib: "DCIMAN32.dll".}
pragma(lib, "dciman32");
extern(Windows)
int WinWatchDidStatusChange(
    void* hWW   // HWINWATCH
);
ccall((:WinWatchDidStatusChange, "DCIMAN32.dll"), stdcall, Int32,
      (Ptr{Cvoid},),
      hWW)
# hWW : HWINWATCH -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t WinWatchDidStatusChange(
    void* hWW);
]]
local dciman32 = ffi.load("dciman32")
-- dciman32.WinWatchDidStatusChange(hWW)
-- hWW : HWINWATCH
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('DCIMAN32.dll');
const WinWatchDidStatusChange = lib.func('__stdcall', 'WinWatchDidStatusChange', 'int32_t', ['void *']);
// WinWatchDidStatusChange(hWW)
// hWW : HWINWATCH -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("DCIMAN32.dll", {
  WinWatchDidStatusChange: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.WinWatchDidStatusChange(hWW)
// hWW : HWINWATCH -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t WinWatchDidStatusChange(
    void* hWW);
C, "DCIMAN32.dll");
// $ffi->WinWatchDidStatusChange(hWW);
// hWW : HWINWATCH
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Dciman32 extends StdCallLibrary {
    Dciman32 INSTANCE = Native.load("dciman32", Dciman32.class);
    boolean WinWatchDidStatusChange(
        Pointer hWW   // HWINWATCH
    );
}
@[Link("dciman32")]
lib LibDCIMAN32
  fun WinWatchDidStatusChange = WinWatchDidStatusChange(
    hWW : Void*   # HWINWATCH
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef WinWatchDidStatusChangeNative = Int32 Function(Pointer<Void>);
typedef WinWatchDidStatusChangeDart = int Function(Pointer<Void>);
final WinWatchDidStatusChange = DynamicLibrary.open('DCIMAN32.dll')
    .lookupFunction<WinWatchDidStatusChangeNative, WinWatchDidStatusChangeDart>('WinWatchDidStatusChange');
// hWW : HWINWATCH -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function WinWatchDidStatusChange(
  hWW: THandle   // HWINWATCH
): BOOL; stdcall;
  external 'DCIMAN32.dll' name 'WinWatchDidStatusChange';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WinWatchDidStatusChange"
  c_WinWatchDidStatusChange :: Ptr () -> IO CInt
-- hWW : HWINWATCH -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let winwatchdidstatuschange =
  foreign "WinWatchDidStatusChange"
    ((ptr void) @-> returning int32_t)
(* hWW : HWINWATCH -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library dciman32 (t "DCIMAN32.dll"))
(cffi:use-foreign-library dciman32)

(cffi:defcfun ("WinWatchDidStatusChange" win-watch-did-status-change :convention :stdcall) :int32
  (h-ww :pointer))   ; HWINWATCH
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WinWatchDidStatusChange = Win32::API::More->new('DCIMAN32',
    'BOOL WinWatchDidStatusChange(HANDLE hWW)');
# my $ret = $WinWatchDidStatusChange->Call($hWW);
# hWW : HWINWATCH -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。