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

Direct3DCreate9

関数
Direct3D9オブジェクトを作成しレンダリング環境を初期化する。
DLLd3d9.dll呼出規約winapi

シグネチャ

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

IDirect3D9* Direct3DCreate9(
    DWORD SDKVersion
);

パラメーター

名前方向
SDKVersionDWORDin

戻り値の型: IDirect3D9*

各言語での呼び出し定義

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

IDirect3D9* Direct3DCreate9(
    DWORD SDKVersion
);
[DllImport("d3d9.dll", ExactSpelling = true)]
static extern IntPtr Direct3DCreate9(
    uint SDKVersion   // DWORD
);
<DllImport("d3d9.dll", ExactSpelling:=True)>
Public Shared Function Direct3DCreate9(
    SDKVersion As UInteger   ' DWORD
) As IntPtr
End Function
' SDKVersion : DWORD
Declare PtrSafe Function Direct3DCreate9 Lib "d3d9" ( _
    ByVal SDKVersion As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

Direct3DCreate9 = ctypes.windll.d3d9.Direct3DCreate9
Direct3DCreate9.restype = ctypes.c_void_p
Direct3DCreate9.argtypes = [
    wintypes.DWORD,  # SDKVersion : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	d3d9 = windows.NewLazySystemDLL("d3d9.dll")
	procDirect3DCreate9 = d3d9.NewProc("Direct3DCreate9")
)

// SDKVersion (DWORD)
r1, _, err := procDirect3DCreate9.Call(
	uintptr(SDKVersion),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // IDirect3D9*
function Direct3DCreate9(
  SDKVersion: DWORD   // DWORD
): Pointer; stdcall;
  external 'd3d9.dll' name 'Direct3DCreate9';
result := DllCall("d3d9\Direct3DCreate9"
    , "UInt", SDKVersion   ; DWORD
    , "Ptr")   ; return: IDirect3D9*
●Direct3DCreate9(SDKVersion) = DLL("d3d9.dll", "void* Direct3DCreate9(dword)")
# 呼び出し: Direct3DCreate9(SDKVersion)
# SDKVersion : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。