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