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

DevicePowerClose

関数
デバイス電源データベースを閉じて解放する。
DLLPOWRPROF.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

BOOLEAN DevicePowerClose(void);

パラメーターなし。戻り値: BOOLEAN

各言語での呼び出し定義

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

BOOLEAN DevicePowerClose(void);
[DllImport("POWRPROF.dll", ExactSpelling = true)]
static extern byte DevicePowerClose();
<DllImport("POWRPROF.dll", ExactSpelling:=True)>
Public Shared Function DevicePowerClose() As Byte
End Function
Declare PtrSafe Function DevicePowerClose Lib "powrprof" () As Byte
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DevicePowerClose = ctypes.windll.powrprof.DevicePowerClose
DevicePowerClose.restype = ctypes.c_byte
DevicePowerClose.argtypes = []
require 'fiddle'
require 'fiddle/import'

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

var (
	powrprof = windows.NewLazySystemDLL("POWRPROF.dll")
	procDevicePowerClose = powrprof.NewProc("DevicePowerClose")
)

r1, _, err := procDevicePowerClose.Call()
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOLEAN
function DevicePowerClose: ByteBool; stdcall;
  external 'POWRPROF.dll' name 'DevicePowerClose';
result := DllCall("POWRPROF\DevicePowerClose", "Char")
●DevicePowerClose() = DLL("POWRPROF.dll", "byte DevicePowerClose()")
# 呼び出し: DevicePowerClose()
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。