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

PowerUnregisterSuspendResumeNotification

関数
サスペンド・レジューム通知の登録を解除する。
DLLPOWRPROF.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

WIN32_ERROR PowerUnregisterSuspendResumeNotification(
    HPOWERNOTIFY RegistrationHandle
);

パラメーター

名前方向
RegistrationHandleHPOWERNOTIFYin

戻り値の型: WIN32_ERROR

各言語での呼び出し定義

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

WIN32_ERROR PowerUnregisterSuspendResumeNotification(
    HPOWERNOTIFY RegistrationHandle
);
[DllImport("POWRPROF.dll", ExactSpelling = true)]
static extern uint PowerUnregisterSuspendResumeNotification(
    IntPtr RegistrationHandle   // HPOWERNOTIFY
);
<DllImport("POWRPROF.dll", ExactSpelling:=True)>
Public Shared Function PowerUnregisterSuspendResumeNotification(
    RegistrationHandle As IntPtr   ' HPOWERNOTIFY
) As UInteger
End Function
' RegistrationHandle : HPOWERNOTIFY
Declare PtrSafe Function PowerUnregisterSuspendResumeNotification Lib "powrprof" ( _
    ByVal RegistrationHandle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PowerUnregisterSuspendResumeNotification = ctypes.windll.powrprof.PowerUnregisterSuspendResumeNotification
PowerUnregisterSuspendResumeNotification.restype = wintypes.DWORD
PowerUnregisterSuspendResumeNotification.argtypes = [
    ctypes.c_ssize_t,  # RegistrationHandle : HPOWERNOTIFY
]
require 'fiddle'
require 'fiddle/import'

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

var (
	powrprof = windows.NewLazySystemDLL("POWRPROF.dll")
	procPowerUnregisterSuspendResumeNotification = powrprof.NewProc("PowerUnregisterSuspendResumeNotification")
)

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