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

RequestWakeupLatency

関数
システム復帰時の待機時間(レイテンシ)を要求する。
DLLKERNEL32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

BOOL RequestWakeupLatency(
    LATENCY_TIME latency
);

パラメーター

名前方向
latencyLATENCY_TIMEin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL RequestWakeupLatency(
    LATENCY_TIME latency
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern bool RequestWakeupLatency(
    int latency   // LATENCY_TIME
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function RequestWakeupLatency(
    latency As Integer   ' LATENCY_TIME
) As Boolean
End Function
' latency : LATENCY_TIME
Declare PtrSafe Function RequestWakeupLatency Lib "kernel32" ( _
    ByVal latency As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RequestWakeupLatency = ctypes.windll.kernel32.RequestWakeupLatency
RequestWakeupLatency.restype = wintypes.BOOL
RequestWakeupLatency.argtypes = [
    ctypes.c_int,  # latency : LATENCY_TIME
]
require 'fiddle'
require 'fiddle/import'

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

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procRequestWakeupLatency = kernel32.NewProc("RequestWakeupLatency")
)

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