ホーム › System.Power › PowerDeterminePlatformRoleEx
PowerDeterminePlatformRoleEx
関数プラットフォームの電源役割(機器種別)を判定する。
シグネチャ
// POWRPROF.dll
#include <windows.h>
POWER_PLATFORM_ROLE PowerDeterminePlatformRoleEx(
POWER_PLATFORM_ROLE_VERSION Version
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Version | POWER_PLATFORM_ROLE_VERSION | in |
戻り値の型: POWER_PLATFORM_ROLE
各言語での呼び出し定義
// POWRPROF.dll
#include <windows.h>
POWER_PLATFORM_ROLE PowerDeterminePlatformRoleEx(
POWER_PLATFORM_ROLE_VERSION Version
);[DllImport("POWRPROF.dll", ExactSpelling = true)]
static extern int PowerDeterminePlatformRoleEx(
uint Version // POWER_PLATFORM_ROLE_VERSION
);<DllImport("POWRPROF.dll", ExactSpelling:=True)>
Public Shared Function PowerDeterminePlatformRoleEx(
Version As UInteger ' POWER_PLATFORM_ROLE_VERSION
) As Integer
End Function' Version : POWER_PLATFORM_ROLE_VERSION
Declare PtrSafe Function PowerDeterminePlatformRoleEx Lib "powrprof" ( _
ByVal Version As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PowerDeterminePlatformRoleEx = ctypes.windll.powrprof.PowerDeterminePlatformRoleEx
PowerDeterminePlatformRoleEx.restype = ctypes.c_int
PowerDeterminePlatformRoleEx.argtypes = [
wintypes.DWORD, # Version : POWER_PLATFORM_ROLE_VERSION
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('POWRPROF.dll')
PowerDeterminePlatformRoleEx = Fiddle::Function.new(
lib['PowerDeterminePlatformRoleEx'],
[
-Fiddle::TYPE_INT, # Version : POWER_PLATFORM_ROLE_VERSION
],
Fiddle::TYPE_INT)#[link(name = "powrprof")]
extern "system" {
fn PowerDeterminePlatformRoleEx(
Version: u32 // POWER_PLATFORM_ROLE_VERSION
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("POWRPROF.dll")]
public static extern int PowerDeterminePlatformRoleEx(uint Version);
"@
$api = Add-Type -MemberDefinition $sig -Name 'POWRPROF_PowerDeterminePlatformRoleEx' -Namespace Win32 -PassThru
# $api::PowerDeterminePlatformRoleEx(Version)#uselib "POWRPROF.dll"
#func global PowerDeterminePlatformRoleEx "PowerDeterminePlatformRoleEx" sptr
; PowerDeterminePlatformRoleEx Version ; 戻り値は stat
; Version : POWER_PLATFORM_ROLE_VERSION -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "POWRPROF.dll"
#cfunc global PowerDeterminePlatformRoleEx "PowerDeterminePlatformRoleEx" int
; res = PowerDeterminePlatformRoleEx(Version)
; Version : POWER_PLATFORM_ROLE_VERSION -> "int"; POWER_PLATFORM_ROLE PowerDeterminePlatformRoleEx(POWER_PLATFORM_ROLE_VERSION Version)
#uselib "POWRPROF.dll"
#cfunc global PowerDeterminePlatformRoleEx "PowerDeterminePlatformRoleEx" int
; res = PowerDeterminePlatformRoleEx(Version)
; Version : POWER_PLATFORM_ROLE_VERSION -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
powrprof = windows.NewLazySystemDLL("POWRPROF.dll")
procPowerDeterminePlatformRoleEx = powrprof.NewProc("PowerDeterminePlatformRoleEx")
)
// Version (POWER_PLATFORM_ROLE_VERSION)
r1, _, err := procPowerDeterminePlatformRoleEx.Call(
uintptr(Version),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // POWER_PLATFORM_ROLEfunction PowerDeterminePlatformRoleEx(
Version: DWORD // POWER_PLATFORM_ROLE_VERSION
): Integer; stdcall;
external 'POWRPROF.dll' name 'PowerDeterminePlatformRoleEx';result := DllCall("POWRPROF\PowerDeterminePlatformRoleEx"
, "UInt", Version ; POWER_PLATFORM_ROLE_VERSION
, "Int") ; return: POWER_PLATFORM_ROLE●PowerDeterminePlatformRoleEx(Version) = DLL("POWRPROF.dll", "int PowerDeterminePlatformRoleEx(dword)")
# 呼び出し: PowerDeterminePlatformRoleEx(Version)
# Version : POWER_PLATFORM_ROLE_VERSION -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。