ホーム › System.Power › PowerGetUserConfiguredACPowerMode
PowerGetUserConfiguredACPowerMode
関数ユーザー構成のAC電源時の電源モードを取得する。
シグネチャ
// POWRPROF.dll
#include <windows.h>
DWORD PowerGetUserConfiguredACPowerMode(
GUID* PowerModeGuid
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| PowerModeGuid | GUID* | out |
戻り値の型: DWORD
各言語での呼び出し定義
// POWRPROF.dll
#include <windows.h>
DWORD PowerGetUserConfiguredACPowerMode(
GUID* PowerModeGuid
);[DllImport("POWRPROF.dll", ExactSpelling = true)]
static extern uint PowerGetUserConfiguredACPowerMode(
out Guid PowerModeGuid // GUID* out
);<DllImport("POWRPROF.dll", ExactSpelling:=True)>
Public Shared Function PowerGetUserConfiguredACPowerMode(
<Out> ByRef PowerModeGuid As Guid ' GUID* out
) As UInteger
End Function' PowerModeGuid : GUID* out
Declare PtrSafe Function PowerGetUserConfiguredACPowerMode Lib "powrprof" ( _
ByVal PowerModeGuid As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PowerGetUserConfiguredACPowerMode = ctypes.windll.powrprof.PowerGetUserConfiguredACPowerMode
PowerGetUserConfiguredACPowerMode.restype = wintypes.DWORD
PowerGetUserConfiguredACPowerMode.argtypes = [
ctypes.c_void_p, # PowerModeGuid : GUID* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('POWRPROF.dll')
PowerGetUserConfiguredACPowerMode = Fiddle::Function.new(
lib['PowerGetUserConfiguredACPowerMode'],
[
Fiddle::TYPE_VOIDP, # PowerModeGuid : GUID* out
],
-Fiddle::TYPE_INT)#[link(name = "powrprof")]
extern "system" {
fn PowerGetUserConfiguredACPowerMode(
PowerModeGuid: *mut GUID // GUID* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("POWRPROF.dll")]
public static extern uint PowerGetUserConfiguredACPowerMode(out Guid PowerModeGuid);
"@
$api = Add-Type -MemberDefinition $sig -Name 'POWRPROF_PowerGetUserConfiguredACPowerMode' -Namespace Win32 -PassThru
# $api::PowerGetUserConfiguredACPowerMode(PowerModeGuid)#uselib "POWRPROF.dll"
#func global PowerGetUserConfiguredACPowerMode "PowerGetUserConfiguredACPowerMode" sptr
; PowerGetUserConfiguredACPowerMode varptr(PowerModeGuid) ; 戻り値は stat
; PowerModeGuid : GUID* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "POWRPROF.dll" #cfunc global PowerGetUserConfiguredACPowerMode "PowerGetUserConfiguredACPowerMode" var ; res = PowerGetUserConfiguredACPowerMode(PowerModeGuid) ; PowerModeGuid : GUID* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "POWRPROF.dll" #cfunc global PowerGetUserConfiguredACPowerMode "PowerGetUserConfiguredACPowerMode" sptr ; res = PowerGetUserConfiguredACPowerMode(varptr(PowerModeGuid)) ; PowerModeGuid : GUID* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD PowerGetUserConfiguredACPowerMode(GUID* PowerModeGuid) #uselib "POWRPROF.dll" #cfunc global PowerGetUserConfiguredACPowerMode "PowerGetUserConfiguredACPowerMode" var ; res = PowerGetUserConfiguredACPowerMode(PowerModeGuid) ; PowerModeGuid : GUID* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD PowerGetUserConfiguredACPowerMode(GUID* PowerModeGuid) #uselib "POWRPROF.dll" #cfunc global PowerGetUserConfiguredACPowerMode "PowerGetUserConfiguredACPowerMode" intptr ; res = PowerGetUserConfiguredACPowerMode(varptr(PowerModeGuid)) ; PowerModeGuid : GUID* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
powrprof = windows.NewLazySystemDLL("POWRPROF.dll")
procPowerGetUserConfiguredACPowerMode = powrprof.NewProc("PowerGetUserConfiguredACPowerMode")
)
// PowerModeGuid (GUID* out)
r1, _, err := procPowerGetUserConfiguredACPowerMode.Call(
uintptr(PowerModeGuid),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction PowerGetUserConfiguredACPowerMode(
PowerModeGuid: PGUID // GUID* out
): DWORD; stdcall;
external 'POWRPROF.dll' name 'PowerGetUserConfiguredACPowerMode';result := DllCall("POWRPROF\PowerGetUserConfiguredACPowerMode"
, "Ptr", PowerModeGuid ; GUID* out
, "UInt") ; return: DWORD●PowerGetUserConfiguredACPowerMode(PowerModeGuid) = DLL("POWRPROF.dll", "dword PowerGetUserConfiguredACPowerMode(void*)")
# 呼び出し: PowerGetUserConfiguredACPowerMode(PowerModeGuid)
# PowerModeGuid : GUID* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。