ホーム › System.Power › GetPwrDiskSpindownRange
GetPwrDiskSpindownRange
関数ディスクのスピンダウン時間の最大値と最小値を取得する。
シグネチャ
// POWRPROF.dll
#include <windows.h>
BOOLEAN GetPwrDiskSpindownRange(
DWORD* puiMax,
DWORD* puiMin
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| puiMax | DWORD* | out | ディスクスピンダウンタイムアウトの最大値(秒)を受け取る出力先。 |
| puiMin | DWORD* | out | ディスクスピンダウンタイムアウトの最小値(秒)を受け取る出力先。 |
戻り値の型: BOOLEAN
各言語での呼び出し定義
// POWRPROF.dll
#include <windows.h>
BOOLEAN GetPwrDiskSpindownRange(
DWORD* puiMax,
DWORD* puiMin
);[DllImport("POWRPROF.dll", SetLastError = true, ExactSpelling = true)]
static extern byte GetPwrDiskSpindownRange(
out uint puiMax, // DWORD* out
out uint puiMin // DWORD* out
);<DllImport("POWRPROF.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetPwrDiskSpindownRange(
<Out> ByRef puiMax As UInteger, ' DWORD* out
<Out> ByRef puiMin As UInteger ' DWORD* out
) As Byte
End Function' puiMax : DWORD* out
' puiMin : DWORD* out
Declare PtrSafe Function GetPwrDiskSpindownRange Lib "powrprof" ( _
ByRef puiMax As Long, _
ByRef puiMin As Long) As Byte
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetPwrDiskSpindownRange = ctypes.windll.powrprof.GetPwrDiskSpindownRange
GetPwrDiskSpindownRange.restype = ctypes.c_byte
GetPwrDiskSpindownRange.argtypes = [
ctypes.POINTER(wintypes.DWORD), # puiMax : DWORD* out
ctypes.POINTER(wintypes.DWORD), # puiMin : DWORD* out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('POWRPROF.dll')
GetPwrDiskSpindownRange = Fiddle::Function.new(
lib['GetPwrDiskSpindownRange'],
[
Fiddle::TYPE_VOIDP, # puiMax : DWORD* out
Fiddle::TYPE_VOIDP, # puiMin : DWORD* out
],
Fiddle::TYPE_CHAR)#[link(name = "powrprof")]
extern "system" {
fn GetPwrDiskSpindownRange(
puiMax: *mut u32, // DWORD* out
puiMin: *mut u32 // DWORD* out
) -> u8;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("POWRPROF.dll", SetLastError = true)]
public static extern byte GetPwrDiskSpindownRange(out uint puiMax, out uint puiMin);
"@
$api = Add-Type -MemberDefinition $sig -Name 'POWRPROF_GetPwrDiskSpindownRange' -Namespace Win32 -PassThru
# $api::GetPwrDiskSpindownRange(puiMax, puiMin)#uselib "POWRPROF.dll"
#func global GetPwrDiskSpindownRange "GetPwrDiskSpindownRange" sptr, sptr
; GetPwrDiskSpindownRange varptr(puiMax), varptr(puiMin) ; 戻り値は stat
; puiMax : DWORD* out -> "sptr"
; puiMin : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "POWRPROF.dll" #cfunc global GetPwrDiskSpindownRange "GetPwrDiskSpindownRange" var, var ; res = GetPwrDiskSpindownRange(puiMax, puiMin) ; puiMax : DWORD* out -> "var" ; puiMin : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "POWRPROF.dll" #cfunc global GetPwrDiskSpindownRange "GetPwrDiskSpindownRange" sptr, sptr ; res = GetPwrDiskSpindownRange(varptr(puiMax), varptr(puiMin)) ; puiMax : DWORD* out -> "sptr" ; puiMin : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOLEAN GetPwrDiskSpindownRange(DWORD* puiMax, DWORD* puiMin) #uselib "POWRPROF.dll" #cfunc global GetPwrDiskSpindownRange "GetPwrDiskSpindownRange" var, var ; res = GetPwrDiskSpindownRange(puiMax, puiMin) ; puiMax : DWORD* out -> "var" ; puiMin : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOLEAN GetPwrDiskSpindownRange(DWORD* puiMax, DWORD* puiMin) #uselib "POWRPROF.dll" #cfunc global GetPwrDiskSpindownRange "GetPwrDiskSpindownRange" intptr, intptr ; res = GetPwrDiskSpindownRange(varptr(puiMax), varptr(puiMin)) ; puiMax : DWORD* out -> "intptr" ; puiMin : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
powrprof = windows.NewLazySystemDLL("POWRPROF.dll")
procGetPwrDiskSpindownRange = powrprof.NewProc("GetPwrDiskSpindownRange")
)
// puiMax (DWORD* out), puiMin (DWORD* out)
r1, _, err := procGetPwrDiskSpindownRange.Call(
uintptr(puiMax),
uintptr(puiMin),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLEANfunction GetPwrDiskSpindownRange(
puiMax: Pointer; // DWORD* out
puiMin: Pointer // DWORD* out
): ByteBool; stdcall;
external 'POWRPROF.dll' name 'GetPwrDiskSpindownRange';result := DllCall("POWRPROF\GetPwrDiskSpindownRange"
, "Ptr", puiMax ; DWORD* out
, "Ptr", puiMin ; DWORD* out
, "Char") ; return: BOOLEAN●GetPwrDiskSpindownRange(puiMax, puiMin) = DLL("POWRPROF.dll", "byte GetPwrDiskSpindownRange(void*, void*)")
# 呼び出し: GetPwrDiskSpindownRange(puiMax, puiMin)
# puiMax : DWORD* out -> "void*"
# puiMin : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。