Win32 API 日本語リファレンス
ホームGraphics.Dwm › DwmModifyPreviousDxFrameDuration

DwmModifyPreviousDxFrameDuration

関数
前のDirectXフレームの表示継続時間を変更する。
DLLdwmapi.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT DwmModifyPreviousDxFrameDuration(
    HWND hwnd,
    INT cRefreshes,
    BOOL fRelative
);

パラメーター

名前方向
hwndHWNDin
cRefreshesINTin
fRelativeBOOLin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT DwmModifyPreviousDxFrameDuration(
    HWND hwnd,
    INT cRefreshes,
    BOOL fRelative
);
[DllImport("dwmapi.dll", ExactSpelling = true)]
static extern int DwmModifyPreviousDxFrameDuration(
    IntPtr hwnd,   // HWND
    int cRefreshes,   // INT
    bool fRelative   // BOOL
);
<DllImport("dwmapi.dll", ExactSpelling:=True)>
Public Shared Function DwmModifyPreviousDxFrameDuration(
    hwnd As IntPtr,   ' HWND
    cRefreshes As Integer,   ' INT
    fRelative As Boolean   ' BOOL
) As Integer
End Function
' hwnd : HWND
' cRefreshes : INT
' fRelative : BOOL
Declare PtrSafe Function DwmModifyPreviousDxFrameDuration Lib "dwmapi" ( _
    ByVal hwnd As LongPtr, _
    ByVal cRefreshes As Long, _
    ByVal fRelative As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DwmModifyPreviousDxFrameDuration = ctypes.windll.dwmapi.DwmModifyPreviousDxFrameDuration
DwmModifyPreviousDxFrameDuration.restype = ctypes.c_int
DwmModifyPreviousDxFrameDuration.argtypes = [
    wintypes.HANDLE,  # hwnd : HWND
    ctypes.c_int,  # cRefreshes : INT
    wintypes.BOOL,  # fRelative : BOOL
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('dwmapi.dll')
DwmModifyPreviousDxFrameDuration = Fiddle::Function.new(
  lib['DwmModifyPreviousDxFrameDuration'],
  [
    Fiddle::TYPE_VOIDP,  # hwnd : HWND
    Fiddle::TYPE_INT,  # cRefreshes : INT
    Fiddle::TYPE_INT,  # fRelative : BOOL
  ],
  Fiddle::TYPE_INT)
#[link(name = "dwmapi")]
extern "system" {
    fn DwmModifyPreviousDxFrameDuration(
        hwnd: *mut core::ffi::c_void,  // HWND
        cRefreshes: i32,  // INT
        fRelative: i32  // BOOL
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("dwmapi.dll")]
public static extern int DwmModifyPreviousDxFrameDuration(IntPtr hwnd, int cRefreshes, bool fRelative);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dwmapi_DwmModifyPreviousDxFrameDuration' -Namespace Win32 -PassThru
# $api::DwmModifyPreviousDxFrameDuration(hwnd, cRefreshes, fRelative)
#uselib "dwmapi.dll"
#func global DwmModifyPreviousDxFrameDuration "DwmModifyPreviousDxFrameDuration" sptr, sptr, sptr
; DwmModifyPreviousDxFrameDuration hwnd, cRefreshes, fRelative   ; 戻り値は stat
; hwnd : HWND -> "sptr"
; cRefreshes : INT -> "sptr"
; fRelative : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "dwmapi.dll"
#cfunc global DwmModifyPreviousDxFrameDuration "DwmModifyPreviousDxFrameDuration" sptr, int, int
; res = DwmModifyPreviousDxFrameDuration(hwnd, cRefreshes, fRelative)
; hwnd : HWND -> "sptr"
; cRefreshes : INT -> "int"
; fRelative : BOOL -> "int"
; HRESULT DwmModifyPreviousDxFrameDuration(HWND hwnd, INT cRefreshes, BOOL fRelative)
#uselib "dwmapi.dll"
#cfunc global DwmModifyPreviousDxFrameDuration "DwmModifyPreviousDxFrameDuration" intptr, int, int
; res = DwmModifyPreviousDxFrameDuration(hwnd, cRefreshes, fRelative)
; hwnd : HWND -> "intptr"
; cRefreshes : INT -> "int"
; fRelative : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dwmapi = windows.NewLazySystemDLL("dwmapi.dll")
	procDwmModifyPreviousDxFrameDuration = dwmapi.NewProc("DwmModifyPreviousDxFrameDuration")
)

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