SHChangeNotifyRegisterThread
関数現在のスレッドをシェル変更通知用に登録する。
シグネチャ
// SHELL32.dll
#include <windows.h>
void SHChangeNotifyRegisterThread(
SCNRT_STATUS status
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| status | SCNRT_STATUS | in | この関数がスレッドの登録に使用されるか、登録解除に使用されるかを示します。SCNRT_STATUS のいずれかの値を指定します。 |
戻り値の型: void
公式ドキュメント
スレッドの非同期での登録および登録解除を有効にします。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// SHELL32.dll
#include <windows.h>
void SHChangeNotifyRegisterThread(
SCNRT_STATUS status
);[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern void SHChangeNotifyRegisterThread(
int status // SCNRT_STATUS
);<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Sub SHChangeNotifyRegisterThread(
status As Integer ' SCNRT_STATUS
)
End Sub' status : SCNRT_STATUS
Declare PtrSafe Sub SHChangeNotifyRegisterThread Lib "shell32" ( _
ByVal status As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SHChangeNotifyRegisterThread = ctypes.windll.shell32.SHChangeNotifyRegisterThread
SHChangeNotifyRegisterThread.restype = None
SHChangeNotifyRegisterThread.argtypes = [
ctypes.c_int, # status : SCNRT_STATUS
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHELL32.dll')
SHChangeNotifyRegisterThread = Fiddle::Function.new(
lib['SHChangeNotifyRegisterThread'],
[
Fiddle::TYPE_INT, # status : SCNRT_STATUS
],
Fiddle::TYPE_VOID)#[link(name = "shell32")]
extern "system" {
fn SHChangeNotifyRegisterThread(
status: i32 // SCNRT_STATUS
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHELL32.dll")]
public static extern void SHChangeNotifyRegisterThread(int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_SHChangeNotifyRegisterThread' -Namespace Win32 -PassThru
# $api::SHChangeNotifyRegisterThread(status)#uselib "SHELL32.dll"
#func global SHChangeNotifyRegisterThread "SHChangeNotifyRegisterThread" sptr
; SHChangeNotifyRegisterThread status
; status : SCNRT_STATUS -> "sptr"#uselib "SHELL32.dll"
#func global SHChangeNotifyRegisterThread "SHChangeNotifyRegisterThread" int
; SHChangeNotifyRegisterThread status
; status : SCNRT_STATUS -> "int"; void SHChangeNotifyRegisterThread(SCNRT_STATUS status)
#uselib "SHELL32.dll"
#func global SHChangeNotifyRegisterThread "SHChangeNotifyRegisterThread" int
; SHChangeNotifyRegisterThread status
; status : SCNRT_STATUS -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shell32 = windows.NewLazySystemDLL("SHELL32.dll")
procSHChangeNotifyRegisterThread = shell32.NewProc("SHChangeNotifyRegisterThread")
)
// status (SCNRT_STATUS)
r1, _, err := procSHChangeNotifyRegisterThread.Call(
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure SHChangeNotifyRegisterThread(
status: Integer // SCNRT_STATUS
); stdcall;
external 'SHELL32.dll' name 'SHChangeNotifyRegisterThread';result := DllCall("SHELL32\SHChangeNotifyRegisterThread"
, "Int", status ; SCNRT_STATUS
, "Int") ; return: void●SHChangeNotifyRegisterThread(status) = DLL("SHELL32.dll", "int SHChangeNotifyRegisterThread(int)")
# 呼び出し: SHChangeNotifyRegisterThread(status)
# status : SCNRT_STATUS -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "shell32" fn SHChangeNotifyRegisterThread(
status: i32 // SCNRT_STATUS
) callconv(std.os.windows.WINAPI) void;proc SHChangeNotifyRegisterThread(
status: int32 # SCNRT_STATUS
) {.importc: "SHChangeNotifyRegisterThread", stdcall, dynlib: "SHELL32.dll".}pragma(lib, "shell32");
extern(Windows)
void SHChangeNotifyRegisterThread(
int status // SCNRT_STATUS
);ccall((:SHChangeNotifyRegisterThread, "SHELL32.dll"), stdcall, Cvoid,
(Int32,),
status)
# status : SCNRT_STATUS -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void SHChangeNotifyRegisterThread(
int32_t status);
]]
local shell32 = ffi.load("shell32")
-- shell32.SHChangeNotifyRegisterThread(status)
-- status : SCNRT_STATUS
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('SHELL32.dll');
const SHChangeNotifyRegisterThread = lib.func('__stdcall', 'SHChangeNotifyRegisterThread', 'void', ['int32_t']);
// SHChangeNotifyRegisterThread(status)
// status : SCNRT_STATUS -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("SHELL32.dll", {
SHChangeNotifyRegisterThread: { parameters: ["i32"], result: "void" },
});
// lib.symbols.SHChangeNotifyRegisterThread(status)
// status : SCNRT_STATUS -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void SHChangeNotifyRegisterThread(
int32_t status);
C, "SHELL32.dll");
// $ffi->SHChangeNotifyRegisterThread(status);
// status : SCNRT_STATUS
// 構造体/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 Shell32 extends StdCallLibrary {
Shell32 INSTANCE = Native.load("shell32", Shell32.class);
void SHChangeNotifyRegisterThread(
int status // SCNRT_STATUS
);
}@[Link("shell32")]
lib LibSHELL32
fun SHChangeNotifyRegisterThread = SHChangeNotifyRegisterThread(
status : Int32 # SCNRT_STATUS
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SHChangeNotifyRegisterThreadNative = Void Function(Int32);
typedef SHChangeNotifyRegisterThreadDart = void Function(int);
final SHChangeNotifyRegisterThread = DynamicLibrary.open('SHELL32.dll')
.lookupFunction<SHChangeNotifyRegisterThreadNative, SHChangeNotifyRegisterThreadDart>('SHChangeNotifyRegisterThread');
// status : SCNRT_STATUS -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure SHChangeNotifyRegisterThread(
status: Integer // SCNRT_STATUS
); stdcall;
external 'SHELL32.dll' name 'SHChangeNotifyRegisterThread';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SHChangeNotifyRegisterThread"
c_SHChangeNotifyRegisterThread :: Int32 -> IO ()
-- status : SCNRT_STATUS -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let shchangenotifyregisterthread =
foreign "SHChangeNotifyRegisterThread"
(int32_t @-> returning void)
(* status : SCNRT_STATUS -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library shell32 (t "SHELL32.dll"))
(cffi:use-foreign-library shell32)
(cffi:defcfun ("SHChangeNotifyRegisterThread" shchange-notify-register-thread :convention :stdcall) :void
(status :int32)) ; SCNRT_STATUS
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SHChangeNotifyRegisterThread = Win32::API::More->new('SHELL32',
'void SHChangeNotifyRegisterThread(int status)');
# my $ret = $SHChangeNotifyRegisterThread->Call($status);
# status : SCNRT_STATUS -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型