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