ホーム › Graphics.Dwm › DwmSetPresentParameters
DwmSetPresentParameters
関数DWMへのフレーム表示パラメーターを設定する。
シグネチャ
// dwmapi.dll
#include <windows.h>
HRESULT DwmSetPresentParameters(
HWND hwnd,
DWM_PRESENT_PARAMETERS* pPresentParams
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwnd | HWND | in |
| pPresentParams | DWM_PRESENT_PARAMETERS* | inout |
戻り値の型: HRESULT
各言語での呼び出し定義
// dwmapi.dll
#include <windows.h>
HRESULT DwmSetPresentParameters(
HWND hwnd,
DWM_PRESENT_PARAMETERS* pPresentParams
);[DllImport("dwmapi.dll", ExactSpelling = true)]
static extern int DwmSetPresentParameters(
IntPtr hwnd, // HWND
IntPtr pPresentParams // DWM_PRESENT_PARAMETERS* in/out
);<DllImport("dwmapi.dll", ExactSpelling:=True)>
Public Shared Function DwmSetPresentParameters(
hwnd As IntPtr, ' HWND
pPresentParams As IntPtr ' DWM_PRESENT_PARAMETERS* in/out
) As Integer
End Function' hwnd : HWND
' pPresentParams : DWM_PRESENT_PARAMETERS* in/out
Declare PtrSafe Function DwmSetPresentParameters Lib "dwmapi" ( _
ByVal hwnd As LongPtr, _
ByVal pPresentParams As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DwmSetPresentParameters = ctypes.windll.dwmapi.DwmSetPresentParameters
DwmSetPresentParameters.restype = ctypes.c_int
DwmSetPresentParameters.argtypes = [
wintypes.HANDLE, # hwnd : HWND
ctypes.c_void_p, # pPresentParams : DWM_PRESENT_PARAMETERS* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dwmapi.dll')
DwmSetPresentParameters = Fiddle::Function.new(
lib['DwmSetPresentParameters'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
Fiddle::TYPE_VOIDP, # pPresentParams : DWM_PRESENT_PARAMETERS* in/out
],
Fiddle::TYPE_INT)#[link(name = "dwmapi")]
extern "system" {
fn DwmSetPresentParameters(
hwnd: *mut core::ffi::c_void, // HWND
pPresentParams: *mut DWM_PRESENT_PARAMETERS // DWM_PRESENT_PARAMETERS* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("dwmapi.dll")]
public static extern int DwmSetPresentParameters(IntPtr hwnd, IntPtr pPresentParams);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dwmapi_DwmSetPresentParameters' -Namespace Win32 -PassThru
# $api::DwmSetPresentParameters(hwnd, pPresentParams)#uselib "dwmapi.dll"
#func global DwmSetPresentParameters "DwmSetPresentParameters" sptr, sptr
; DwmSetPresentParameters hwnd, varptr(pPresentParams) ; 戻り値は stat
; hwnd : HWND -> "sptr"
; pPresentParams : DWM_PRESENT_PARAMETERS* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "dwmapi.dll" #cfunc global DwmSetPresentParameters "DwmSetPresentParameters" sptr, var ; res = DwmSetPresentParameters(hwnd, pPresentParams) ; hwnd : HWND -> "sptr" ; pPresentParams : DWM_PRESENT_PARAMETERS* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "dwmapi.dll" #cfunc global DwmSetPresentParameters "DwmSetPresentParameters" sptr, sptr ; res = DwmSetPresentParameters(hwnd, varptr(pPresentParams)) ; hwnd : HWND -> "sptr" ; pPresentParams : DWM_PRESENT_PARAMETERS* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT DwmSetPresentParameters(HWND hwnd, DWM_PRESENT_PARAMETERS* pPresentParams) #uselib "dwmapi.dll" #cfunc global DwmSetPresentParameters "DwmSetPresentParameters" intptr, var ; res = DwmSetPresentParameters(hwnd, pPresentParams) ; hwnd : HWND -> "intptr" ; pPresentParams : DWM_PRESENT_PARAMETERS* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT DwmSetPresentParameters(HWND hwnd, DWM_PRESENT_PARAMETERS* pPresentParams) #uselib "dwmapi.dll" #cfunc global DwmSetPresentParameters "DwmSetPresentParameters" intptr, intptr ; res = DwmSetPresentParameters(hwnd, varptr(pPresentParams)) ; hwnd : HWND -> "intptr" ; pPresentParams : DWM_PRESENT_PARAMETERS* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dwmapi = windows.NewLazySystemDLL("dwmapi.dll")
procDwmSetPresentParameters = dwmapi.NewProc("DwmSetPresentParameters")
)
// hwnd (HWND), pPresentParams (DWM_PRESENT_PARAMETERS* in/out)
r1, _, err := procDwmSetPresentParameters.Call(
uintptr(hwnd),
uintptr(pPresentParams),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DwmSetPresentParameters(
hwnd: THandle; // HWND
pPresentParams: Pointer // DWM_PRESENT_PARAMETERS* in/out
): Integer; stdcall;
external 'dwmapi.dll' name 'DwmSetPresentParameters';result := DllCall("dwmapi\DwmSetPresentParameters"
, "Ptr", hwnd ; HWND
, "Ptr", pPresentParams ; DWM_PRESENT_PARAMETERS* in/out
, "Int") ; return: HRESULT●DwmSetPresentParameters(hwnd, pPresentParams) = DLL("dwmapi.dll", "int DwmSetPresentParameters(void*, void*)")
# 呼び出し: DwmSetPresentParameters(hwnd, pPresentParams)
# hwnd : HWND -> "void*"
# pPresentParams : DWM_PRESENT_PARAMETERS* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。