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

PowerSettingUnregisterNotification

関数
電源設定変更通知の登録を解除する。
DLLPOWRPROF.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

WIN32_ERROR PowerSettingUnregisterNotification(
    HPOWERNOTIFY RegistrationHandle
);

パラメーター

名前方向
RegistrationHandleHPOWERNOTIFYin

戻り値の型: WIN32_ERROR

各言語での呼び出し定義

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

WIN32_ERROR PowerSettingUnregisterNotification(
    HPOWERNOTIFY RegistrationHandle
);
[DllImport("POWRPROF.dll", ExactSpelling = true)]
static extern uint PowerSettingUnregisterNotification(
    IntPtr RegistrationHandle   // HPOWERNOTIFY
);
<DllImport("POWRPROF.dll", ExactSpelling:=True)>
Public Shared Function PowerSettingUnregisterNotification(
    RegistrationHandle As IntPtr   ' HPOWERNOTIFY
) As UInteger
End Function
' RegistrationHandle : HPOWERNOTIFY
Declare PtrSafe Function PowerSettingUnregisterNotification 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

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

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

var (
	powrprof = windows.NewLazySystemDLL("POWRPROF.dll")
	procPowerSettingUnregisterNotification = powrprof.NewProc("PowerSettingUnregisterNotification")
)

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