ホーム › Graphics.CompositionSwapchain › CreatePresentationFactory
CreatePresentationFactory
関数D3Dデバイスからプレゼンテーションファクトリを生成する。
シグネチャ
// dcomp.dll
#include <windows.h>
HRESULT CreatePresentationFactory(
IUnknown* d3dDevice,
const GUID* riid,
void** presentationFactory
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| d3dDevice | IUnknown* | in | プレゼンテーション処理に用いるD3DまたはDXGIデバイスのIUnknownへのポインター。 |
| riid | GUID* | in | 要求するプレゼンテーションファクトリインターフェイスのGUIDへのポインター。 |
| presentationFactory | void** | 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 方式にも切替可。#uselib "dcomp.dll" #cfunc global CreatePresentationFactory "CreatePresentationFactory" sptr, sptr, sptr ; res = CreatePresentationFactory(d3dDevice, varptr(riid), presentationFactory) ; d3dDevice : IUnknown* -> "sptr" ; riid : GUID* -> "sptr" ; presentationFactory : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; HRESULT CreatePresentationFactory(IUnknown* d3dDevice, GUID* riid, void** presentationFactory) #uselib "dcomp.dll" #cfunc global CreatePresentationFactory "CreatePresentationFactory" intptr, intptr, intptr ; res = CreatePresentationFactory(d3dDevice, varptr(riid), presentationFactory) ; d3dDevice : IUnknown* -> "intptr" ; riid : GUID* -> "intptr" ; presentationFactory : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // HRESULTfunction 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)。const std = @import("std");
extern "dcomp" fn CreatePresentationFactory(
d3dDevice: ?*anyopaque, // IUnknown*
riid: [*c]GUID, // GUID*
presentationFactory: ?*anyopaque // void** out
) callconv(std.os.windows.WINAPI) i32;proc CreatePresentationFactory(
d3dDevice: pointer, # IUnknown*
riid: ptr GUID, # GUID*
presentationFactory: pointer # void** out
): int32 {.importc: "CreatePresentationFactory", stdcall, dynlib: "dcomp.dll".}pragma(lib, "dcomp");
extern(Windows)
int CreatePresentationFactory(
void* d3dDevice, // IUnknown*
GUID* riid, // GUID*
void** presentationFactory // void** out
);ccall((:CreatePresentationFactory, "dcomp.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{GUID}, Ptr{Cvoid}),
d3dDevice, riid, presentationFactory)
# d3dDevice : IUnknown* -> Ptr{Cvoid}
# riid : GUID* -> Ptr{GUID}
# presentationFactory : void** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CreatePresentationFactory(
void* d3dDevice,
void* riid,
void** presentationFactory);
]]
local dcomp = ffi.load("dcomp")
-- dcomp.CreatePresentationFactory(d3dDevice, riid, presentationFactory)
-- d3dDevice : IUnknown*
-- riid : GUID*
-- presentationFactory : void** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('dcomp.dll');
const CreatePresentationFactory = lib.func('__stdcall', 'CreatePresentationFactory', 'int32_t', ['void *', 'void *', 'void *']);
// CreatePresentationFactory(d3dDevice, riid, presentationFactory)
// d3dDevice : IUnknown* -> 'void *'
// riid : GUID* -> 'void *'
// presentationFactory : void** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("dcomp.dll", {
CreatePresentationFactory: { parameters: ["pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.CreatePresentationFactory(d3dDevice, riid, presentationFactory)
// d3dDevice : IUnknown* -> "pointer"
// riid : GUID* -> "pointer"
// presentationFactory : void** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CreatePresentationFactory(
void* d3dDevice,
void* riid,
void** presentationFactory);
C, "dcomp.dll");
// $ffi->CreatePresentationFactory(d3dDevice, riid, presentationFactory);
// d3dDevice : IUnknown*
// riid : GUID*
// presentationFactory : void** out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Dcomp extends StdCallLibrary {
Dcomp INSTANCE = Native.load("dcomp", Dcomp.class);
int CreatePresentationFactory(
Pointer d3dDevice, // IUnknown*
Pointer riid, // GUID*
Pointer presentationFactory // void** out
);
}@[Link("dcomp")]
lib Libdcomp
fun CreatePresentationFactory = CreatePresentationFactory(
d3dDevice : Void*, # IUnknown*
riid : GUID*, # GUID*
presentationFactory : Void** # void** out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CreatePresentationFactoryNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef CreatePresentationFactoryDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
final CreatePresentationFactory = DynamicLibrary.open('dcomp.dll')
.lookupFunction<CreatePresentationFactoryNative, CreatePresentationFactoryDart>('CreatePresentationFactory');
// d3dDevice : IUnknown* -> Pointer<Void>
// riid : GUID* -> Pointer<Void>
// presentationFactory : void** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CreatePresentationFactory(
d3dDevice: Pointer; // IUnknown*
riid: PGUID; // GUID*
presentationFactory: Pointer // void** out
): Integer; stdcall;
external 'dcomp.dll' name 'CreatePresentationFactory';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CreatePresentationFactory"
c_CreatePresentationFactory :: Ptr () -> Ptr () -> Ptr () -> IO Int32
-- d3dDevice : IUnknown* -> Ptr ()
-- riid : GUID* -> Ptr ()
-- presentationFactory : void** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let createpresentationfactory =
foreign "CreatePresentationFactory"
((ptr void) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* d3dDevice : IUnknown* -> (ptr void) *)
(* riid : GUID* -> (ptr void) *)
(* presentationFactory : void** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library dcomp (t "dcomp.dll"))
(cffi:use-foreign-library dcomp)
(cffi:defcfun ("CreatePresentationFactory" create-presentation-factory :convention :stdcall) :int32
(d3d-device :pointer) ; IUnknown*
(riid :pointer) ; GUID*
(presentation-factory :pointer)) ; void** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CreatePresentationFactory = Win32::API::More->new('dcomp',
'int CreatePresentationFactory(LPVOID d3dDevice, LPVOID riid, LPVOID presentationFactory)');
# my $ret = $CreatePresentationFactory->Call($d3dDevice, $riid, $presentationFactory);
# d3dDevice : IUnknown* -> LPVOID
# riid : GUID* -> LPVOID
# presentationFactory : void** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型