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