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

PowerDeterminePlatformRole

関数
プラットフォームの役割(デスクトップ・モバイル等)を判定する。
DLLPOWRPROF.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

POWER_PLATFORM_ROLE PowerDeterminePlatformRole(void);

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

各言語での呼び出し定義

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

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

PowerDeterminePlatformRole = ctypes.windll.powrprof.PowerDeterminePlatformRole
PowerDeterminePlatformRole.restype = ctypes.c_int
PowerDeterminePlatformRole.argtypes = []
require 'fiddle'
require 'fiddle/import'

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

var (
	powrprof = windows.NewLazySystemDLL("POWRPROF.dll")
	procPowerDeterminePlatformRole = powrprof.NewProc("PowerDeterminePlatformRole")
)

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