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

CreatePresentationFactory

関数
D3Dデバイスからプレゼンテーションファクトリを生成する。
DLLdcomp.dll呼出規約winapi

シグネチャ

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

HRESULT CreatePresentationFactory(
    IUnknown* d3dDevice,
    const GUID* riid,
    void** presentationFactory
);

パラメーター

名前方向
d3dDeviceIUnknown*in
riidGUID*in
presentationFactoryvoid**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT CreatePresentationFactory(
    IUnknown* d3dDevice,
    const GUID* riid,
    void** presentationFactory
);
[DllImport("dcomp.dll", ExactSpelling = true)]
static extern int CreatePresentationFactory(
    IntPtr d3dDevice,   // IUnknown*
    ref Guid riid,   // GUID*
    IntPtr presentationFactory   // void** out
);
<DllImport("dcomp.dll", ExactSpelling:=True)>
Public Shared Function CreatePresentationFactory(
    d3dDevice As IntPtr,   ' IUnknown*
    ByRef riid As Guid,   ' GUID*
    presentationFactory As IntPtr   ' void** out
) As Integer
End Function
' d3dDevice : IUnknown*
' riid : GUID*
' presentationFactory : void** out
Declare PtrSafe Function CreatePresentationFactory Lib "dcomp" ( _
    ByVal d3dDevice As LongPtr, _
    ByVal riid As LongPtr, _
    ByVal presentationFactory As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CreatePresentationFactory = ctypes.windll.dcomp.CreatePresentationFactory
CreatePresentationFactory.restype = ctypes.c_int
CreatePresentationFactory.argtypes = [
    ctypes.c_void_p,  # d3dDevice : IUnknown*
    ctypes.c_void_p,  # riid : GUID*
    ctypes.c_void_p,  # presentationFactory : void** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('dcomp.dll')
CreatePresentationFactory = Fiddle::Function.new(
  lib['CreatePresentationFactory'],
  [
    Fiddle::TYPE_VOIDP,  # d3dDevice : IUnknown*
    Fiddle::TYPE_VOIDP,  # riid : GUID*
    Fiddle::TYPE_VOIDP,  # presentationFactory : void** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "dcomp")]
extern "system" {
    fn CreatePresentationFactory(
        d3dDevice: *mut core::ffi::c_void,  // IUnknown*
        riid: *const GUID,  // GUID*
        presentationFactory: *mut *mut ()  // void** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("dcomp.dll")]
public static extern int CreatePresentationFactory(IntPtr d3dDevice, ref Guid riid, IntPtr presentationFactory);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dcomp_CreatePresentationFactory' -Namespace Win32 -PassThru
# $api::CreatePresentationFactory(d3dDevice, riid, presentationFactory)
#uselib "dcomp.dll"
#func global CreatePresentationFactory "CreatePresentationFactory" sptr, sptr, sptr
; CreatePresentationFactory d3dDevice, varptr(riid), presentationFactory   ; 戻り値は stat
; d3dDevice : IUnknown* -> "sptr"
; riid : GUID* -> "sptr"
; presentationFactory : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "dcomp.dll"
#cfunc global CreatePresentationFactory "CreatePresentationFactory" sptr, var, sptr
; res = CreatePresentationFactory(d3dDevice, riid, presentationFactory)
; d3dDevice : IUnknown* -> "sptr"
; riid : GUID* -> "var"
; presentationFactory : void** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT CreatePresentationFactory(IUnknown* d3dDevice, GUID* riid, void** presentationFactory)
#uselib "dcomp.dll"
#cfunc global CreatePresentationFactory "CreatePresentationFactory" intptr, var, intptr
; res = CreatePresentationFactory(d3dDevice, riid, presentationFactory)
; d3dDevice : IUnknown* -> "intptr"
; riid : GUID* -> "var"
; presentationFactory : void** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dcomp = windows.NewLazySystemDLL("dcomp.dll")
	procCreatePresentationFactory = dcomp.NewProc("CreatePresentationFactory")
)

// d3dDevice (IUnknown*), riid (GUID*), presentationFactory (void** out)
r1, _, err := procCreatePresentationFactory.Call(
	uintptr(d3dDevice),
	uintptr(riid),
	uintptr(presentationFactory),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function CreatePresentationFactory(
  d3dDevice: Pointer;   // IUnknown*
  riid: PGUID;   // GUID*
  presentationFactory: Pointer   // void** out
): Integer; stdcall;
  external 'dcomp.dll' name 'CreatePresentationFactory';
result := DllCall("dcomp\CreatePresentationFactory"
    , "Ptr", d3dDevice   ; IUnknown*
    , "Ptr", riid   ; GUID*
    , "Ptr", presentationFactory   ; void** out
    , "Int")   ; return: HRESULT
●CreatePresentationFactory(d3dDevice, riid, presentationFactory) = DLL("dcomp.dll", "int CreatePresentationFactory(void*, void*, void*)")
# 呼び出し: CreatePresentationFactory(d3dDevice, riid, presentationFactory)
# d3dDevice : IUnknown* -> "void*"
# riid : GUID* -> "void*"
# presentationFactory : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。