SHChangeNotify
関数シェルにファイルやフォルダーの変更イベントを通知する。
シグネチャ
// SHELL32.dll
#include <windows.h>
void SHChangeNotify(
INT wEventId,
SHCNF_FLAGS uFlags,
const void* dwItem1, // optional
const void* dwItem2 // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| wEventId | INT | in |
| uFlags | SHCNF_FLAGS | in |
| dwItem1 | void* | inoptional |
| dwItem2 | void* | inoptional |
戻り値の型: void
各言語での呼び出し定義
// SHELL32.dll
#include <windows.h>
void SHChangeNotify(
INT wEventId,
SHCNF_FLAGS uFlags,
const void* dwItem1, // optional
const void* dwItem2 // optional
);[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern void SHChangeNotify(
int wEventId, // INT
uint uFlags, // SHCNF_FLAGS
IntPtr dwItem1, // void* optional
IntPtr dwItem2 // void* optional
);<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Sub SHChangeNotify(
wEventId As Integer, ' INT
uFlags As UInteger, ' SHCNF_FLAGS
dwItem1 As IntPtr, ' void* optional
dwItem2 As IntPtr ' void* optional
)
End Sub' wEventId : INT
' uFlags : SHCNF_FLAGS
' dwItem1 : void* optional
' dwItem2 : void* optional
Declare PtrSafe Sub SHChangeNotify Lib "shell32" ( _
ByVal wEventId As Long, _
ByVal uFlags As Long, _
ByVal dwItem1 As LongPtr, _
ByVal dwItem2 As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SHChangeNotify = ctypes.windll.shell32.SHChangeNotify
SHChangeNotify.restype = None
SHChangeNotify.argtypes = [
ctypes.c_int, # wEventId : INT
wintypes.DWORD, # uFlags : SHCNF_FLAGS
ctypes.POINTER(None), # dwItem1 : void* optional
ctypes.POINTER(None), # dwItem2 : void* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHELL32.dll')
SHChangeNotify = Fiddle::Function.new(
lib['SHChangeNotify'],
[
Fiddle::TYPE_INT, # wEventId : INT
-Fiddle::TYPE_INT, # uFlags : SHCNF_FLAGS
Fiddle::TYPE_VOIDP, # dwItem1 : void* optional
Fiddle::TYPE_VOIDP, # dwItem2 : void* optional
],
Fiddle::TYPE_VOID)#[link(name = "shell32")]
extern "system" {
fn SHChangeNotify(
wEventId: i32, // INT
uFlags: u32, // SHCNF_FLAGS
dwItem1: *const (), // void* optional
dwItem2: *const () // void* optional
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHELL32.dll")]
public static extern void SHChangeNotify(int wEventId, uint uFlags, IntPtr dwItem1, IntPtr dwItem2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_SHChangeNotify' -Namespace Win32 -PassThru
# $api::SHChangeNotify(wEventId, uFlags, dwItem1, dwItem2)#uselib "SHELL32.dll"
#func global SHChangeNotify "SHChangeNotify" sptr, sptr, sptr, sptr
; SHChangeNotify wEventId, uFlags, dwItem1, dwItem2
; wEventId : INT -> "sptr"
; uFlags : SHCNF_FLAGS -> "sptr"
; dwItem1 : void* optional -> "sptr"
; dwItem2 : void* optional -> "sptr"#uselib "SHELL32.dll"
#func global SHChangeNotify "SHChangeNotify" int, int, sptr, sptr
; SHChangeNotify wEventId, uFlags, dwItem1, dwItem2
; wEventId : INT -> "int"
; uFlags : SHCNF_FLAGS -> "int"
; dwItem1 : void* optional -> "sptr"
; dwItem2 : void* optional -> "sptr"; void SHChangeNotify(INT wEventId, SHCNF_FLAGS uFlags, void* dwItem1, void* dwItem2)
#uselib "SHELL32.dll"
#func global SHChangeNotify "SHChangeNotify" int, int, intptr, intptr
; SHChangeNotify wEventId, uFlags, dwItem1, dwItem2
; wEventId : INT -> "int"
; uFlags : SHCNF_FLAGS -> "int"
; dwItem1 : void* optional -> "intptr"
; dwItem2 : void* optional -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shell32 = windows.NewLazySystemDLL("SHELL32.dll")
procSHChangeNotify = shell32.NewProc("SHChangeNotify")
)
// wEventId (INT), uFlags (SHCNF_FLAGS), dwItem1 (void* optional), dwItem2 (void* optional)
r1, _, err := procSHChangeNotify.Call(
uintptr(wEventId),
uintptr(uFlags),
uintptr(dwItem1),
uintptr(dwItem2),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure SHChangeNotify(
wEventId: Integer; // INT
uFlags: DWORD; // SHCNF_FLAGS
dwItem1: Pointer; // void* optional
dwItem2: Pointer // void* optional
); stdcall;
external 'SHELL32.dll' name 'SHChangeNotify';result := DllCall("SHELL32\SHChangeNotify"
, "Int", wEventId ; INT
, "UInt", uFlags ; SHCNF_FLAGS
, "Ptr", dwItem1 ; void* optional
, "Ptr", dwItem2 ; void* optional
, "Int") ; return: void●SHChangeNotify(wEventId, uFlags, dwItem1, dwItem2) = DLL("SHELL32.dll", "int SHChangeNotify(int, dword, void*, void*)")
# 呼び出し: SHChangeNotify(wEventId, uFlags, dwItem1, dwItem2)
# wEventId : INT -> "int"
# uFlags : SHCNF_FLAGS -> "dword"
# dwItem1 : void* optional -> "void*"
# dwItem2 : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。