ホーム › System.Power › IsPwrShutdownAllowed
IsPwrShutdownAllowed
関数システムのシャットダウンが許可されているか判定する。
シグネチャ
// POWRPROF.dll
#include <windows.h>
BOOLEAN IsPwrShutdownAllowed(void);パラメーターなし。戻り値: BOOLEAN
各言語での呼び出し定義
// POWRPROF.dll
#include <windows.h>
BOOLEAN IsPwrShutdownAllowed(void);[DllImport("POWRPROF.dll", ExactSpelling = true)]
static extern byte IsPwrShutdownAllowed();<DllImport("POWRPROF.dll", ExactSpelling:=True)>
Public Shared Function IsPwrShutdownAllowed() As Byte
End FunctionDeclare PtrSafe Function IsPwrShutdownAllowed Lib "powrprof" () As Byte
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
IsPwrShutdownAllowed = ctypes.windll.powrprof.IsPwrShutdownAllowed
IsPwrShutdownAllowed.restype = ctypes.c_byte
IsPwrShutdownAllowed.argtypes = []require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('POWRPROF.dll')
IsPwrShutdownAllowed = Fiddle::Function.new(
lib['IsPwrShutdownAllowed'],
[],
Fiddle::TYPE_CHAR)#[link(name = "powrprof")]
extern "system" {
fn IsPwrShutdownAllowed() -> u8;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("POWRPROF.dll")]
public static extern byte IsPwrShutdownAllowed();
"@
$api = Add-Type -MemberDefinition $sig -Name 'POWRPROF_IsPwrShutdownAllowed' -Namespace Win32 -PassThru
# $api::IsPwrShutdownAllowed()#uselib "POWRPROF.dll"
#func global IsPwrShutdownAllowed "IsPwrShutdownAllowed"
; IsPwrShutdownAllowed ; 戻り値は stat
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "POWRPROF.dll"
#cfunc global IsPwrShutdownAllowed "IsPwrShutdownAllowed"
; res = IsPwrShutdownAllowed(); BOOLEAN IsPwrShutdownAllowed()
#uselib "POWRPROF.dll"
#cfunc global IsPwrShutdownAllowed "IsPwrShutdownAllowed"
; res = IsPwrShutdownAllowed()import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
powrprof = windows.NewLazySystemDLL("POWRPROF.dll")
procIsPwrShutdownAllowed = powrprof.NewProc("IsPwrShutdownAllowed")
)
r1, _, err := procIsPwrShutdownAllowed.Call()
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLEANfunction IsPwrShutdownAllowed: ByteBool; stdcall;
external 'POWRPROF.dll' name 'IsPwrShutdownAllowed';result := DllCall("POWRPROF\IsPwrShutdownAllowed", "Char")●IsPwrShutdownAllowed() = DLL("POWRPROF.dll", "byte IsPwrShutdownAllowed()")
# 呼び出し: IsPwrShutdownAllowed()
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。