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

UnregisterGPNotification

関数
グループポリシー変更通知を登録解除する。
DLLUSERENV.dll呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

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

BOOL UnregisterGPNotification(
    HANDLE hEvent
);

パラメーター

名前方向
hEventHANDLEin

戻り値の型: BOOL

各言語での呼び出し定義

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

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

UnregisterGPNotification = ctypes.windll.userenv.UnregisterGPNotification
UnregisterGPNotification.restype = wintypes.BOOL
UnregisterGPNotification.argtypes = [
    wintypes.HANDLE,  # hEvent : HANDLE
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	userenv = windows.NewLazySystemDLL("USERENV.dll")
	procUnregisterGPNotification = userenv.NewProc("UnregisterGPNotification")
)

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