ホーム › System.Power › UnregisterPowerSettingNotification
UnregisterPowerSettingNotification
関数電源設定変更通知の登録を解除する。
シグネチャ
// USER32.dll
#include <windows.h>
BOOL UnregisterPowerSettingNotification(
HPOWERNOTIFY Handle
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Handle | HPOWERNOTIFY | in |
戻り値の型: BOOL
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
BOOL UnregisterPowerSettingNotification(
HPOWERNOTIFY Handle
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool UnregisterPowerSettingNotification(
IntPtr Handle // HPOWERNOTIFY
);<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function UnregisterPowerSettingNotification(
Handle As IntPtr ' HPOWERNOTIFY
) As Boolean
End Function' Handle : HPOWERNOTIFY
Declare PtrSafe Function UnregisterPowerSettingNotification 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
UnregisterPowerSettingNotification = ctypes.windll.user32.UnregisterPowerSettingNotification
UnregisterPowerSettingNotification.restype = wintypes.BOOL
UnregisterPowerSettingNotification.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')
UnregisterPowerSettingNotification = Fiddle::Function.new(
lib['UnregisterPowerSettingNotification'],
[
Fiddle::TYPE_INTPTR_T, # Handle : HPOWERNOTIFY
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn UnregisterPowerSettingNotification(
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 UnregisterPowerSettingNotification(IntPtr Handle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_UnregisterPowerSettingNotification' -Namespace Win32 -PassThru
# $api::UnregisterPowerSettingNotification(Handle)#uselib "USER32.dll"
#func global UnregisterPowerSettingNotification "UnregisterPowerSettingNotification" sptr
; UnregisterPowerSettingNotification Handle ; 戻り値は stat
; Handle : HPOWERNOTIFY -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global UnregisterPowerSettingNotification "UnregisterPowerSettingNotification" sptr
; res = UnregisterPowerSettingNotification(Handle)
; Handle : HPOWERNOTIFY -> "sptr"; BOOL UnregisterPowerSettingNotification(HPOWERNOTIFY Handle)
#uselib "USER32.dll"
#cfunc global UnregisterPowerSettingNotification "UnregisterPowerSettingNotification" intptr
; res = UnregisterPowerSettingNotification(Handle)
; Handle : HPOWERNOTIFY -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procUnregisterPowerSettingNotification = user32.NewProc("UnregisterPowerSettingNotification")
)
// Handle (HPOWERNOTIFY)
r1, _, err := procUnregisterPowerSettingNotification.Call(
uintptr(Handle),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction UnregisterPowerSettingNotification(
Handle: NativeInt // HPOWERNOTIFY
): BOOL; stdcall;
external 'USER32.dll' name 'UnregisterPowerSettingNotification';result := DllCall("USER32\UnregisterPowerSettingNotification"
, "Ptr", Handle ; HPOWERNOTIFY
, "Int") ; return: BOOL●UnregisterPowerSettingNotification(Handle) = DLL("USER32.dll", "bool UnregisterPowerSettingNotification(int)")
# 呼び出し: UnregisterPowerSettingNotification(Handle)
# Handle : HPOWERNOTIFY -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。