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

UnregisterSuspendResumeNotification

関数
サスペンド・再開通知の登録を解除する。
DLLUSER32.dll呼出規約winapiSetLastErrorあり対応OSwindows8.0

シグネチャ

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

BOOL UnregisterSuspendResumeNotification(
    HPOWERNOTIFY Handle
);

パラメーター

名前方向
HandleHPOWERNOTIFYin

戻り値の型: BOOL

各言語での呼び出し定義

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

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

UnregisterSuspendResumeNotification = ctypes.windll.user32.UnregisterSuspendResumeNotification
UnregisterSuspendResumeNotification.restype = wintypes.BOOL
UnregisterSuspendResumeNotification.argtypes = [
    ctypes.c_ssize_t,  # Handle : HPOWERNOTIFY
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procUnregisterSuspendResumeNotification = user32.NewProc("UnregisterSuspendResumeNotification")
)

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