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