ホーム › System.Ole › CreateTypeLib
CreateTypeLib
関数新しいタイプライブラリを作成する作成オブジェクトを生成する。
シグネチャ
// OLEAUT32.dll
#include <windows.h>
HRESULT CreateTypeLib(
SYSKIND syskind,
LPCWSTR szFile,
ICreateTypeLib** ppctlib
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| syskind | SYSKIND | in |
| szFile | LPCWSTR | in |
| ppctlib | ICreateTypeLib** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// OLEAUT32.dll
#include <windows.h>
HRESULT CreateTypeLib(
SYSKIND syskind,
LPCWSTR szFile,
ICreateTypeLib** ppctlib
);[DllImport("OLEAUT32.dll", ExactSpelling = true)]
static extern int CreateTypeLib(
int syskind, // SYSKIND
[MarshalAs(UnmanagedType.LPWStr)] string szFile, // LPCWSTR
IntPtr ppctlib // ICreateTypeLib** out
);<DllImport("OLEAUT32.dll", ExactSpelling:=True)>
Public Shared Function CreateTypeLib(
syskind As Integer, ' SYSKIND
<MarshalAs(UnmanagedType.LPWStr)> szFile As String, ' LPCWSTR
ppctlib As IntPtr ' ICreateTypeLib** out
) As Integer
End Function' syskind : SYSKIND
' szFile : LPCWSTR
' ppctlib : ICreateTypeLib** out
Declare PtrSafe Function CreateTypeLib Lib "oleaut32" ( _
ByVal syskind As Long, _
ByVal szFile As LongPtr, _
ByVal ppctlib As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateTypeLib = ctypes.windll.oleaut32.CreateTypeLib
CreateTypeLib.restype = ctypes.c_int
CreateTypeLib.argtypes = [
ctypes.c_int, # syskind : SYSKIND
wintypes.LPCWSTR, # szFile : LPCWSTR
ctypes.c_void_p, # ppctlib : ICreateTypeLib** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLEAUT32.dll')
CreateTypeLib = Fiddle::Function.new(
lib['CreateTypeLib'],
[
Fiddle::TYPE_INT, # syskind : SYSKIND
Fiddle::TYPE_VOIDP, # szFile : LPCWSTR
Fiddle::TYPE_VOIDP, # ppctlib : ICreateTypeLib** out
],
Fiddle::TYPE_INT)#[link(name = "oleaut32")]
extern "system" {
fn CreateTypeLib(
syskind: i32, // SYSKIND
szFile: *const u16, // LPCWSTR
ppctlib: *mut *mut core::ffi::c_void // ICreateTypeLib** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLEAUT32.dll")]
public static extern int CreateTypeLib(int syskind, [MarshalAs(UnmanagedType.LPWStr)] string szFile, IntPtr ppctlib);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLEAUT32_CreateTypeLib' -Namespace Win32 -PassThru
# $api::CreateTypeLib(syskind, szFile, ppctlib)#uselib "OLEAUT32.dll"
#func global CreateTypeLib "CreateTypeLib" sptr, sptr, sptr
; CreateTypeLib syskind, szFile, ppctlib ; 戻り値は stat
; syskind : SYSKIND -> "sptr"
; szFile : LPCWSTR -> "sptr"
; ppctlib : ICreateTypeLib** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "OLEAUT32.dll"
#cfunc global CreateTypeLib "CreateTypeLib" int, wstr, sptr
; res = CreateTypeLib(syskind, szFile, ppctlib)
; syskind : SYSKIND -> "int"
; szFile : LPCWSTR -> "wstr"
; ppctlib : ICreateTypeLib** out -> "sptr"; HRESULT CreateTypeLib(SYSKIND syskind, LPCWSTR szFile, ICreateTypeLib** ppctlib)
#uselib "OLEAUT32.dll"
#cfunc global CreateTypeLib "CreateTypeLib" int, wstr, intptr
; res = CreateTypeLib(syskind, szFile, ppctlib)
; syskind : SYSKIND -> "int"
; szFile : LPCWSTR -> "wstr"
; ppctlib : ICreateTypeLib** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
oleaut32 = windows.NewLazySystemDLL("OLEAUT32.dll")
procCreateTypeLib = oleaut32.NewProc("CreateTypeLib")
)
// syskind (SYSKIND), szFile (LPCWSTR), ppctlib (ICreateTypeLib** out)
r1, _, err := procCreateTypeLib.Call(
uintptr(syskind),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szFile))),
uintptr(ppctlib),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CreateTypeLib(
syskind: Integer; // SYSKIND
szFile: PWideChar; // LPCWSTR
ppctlib: Pointer // ICreateTypeLib** out
): Integer; stdcall;
external 'OLEAUT32.dll' name 'CreateTypeLib';result := DllCall("OLEAUT32\CreateTypeLib"
, "Int", syskind ; SYSKIND
, "WStr", szFile ; LPCWSTR
, "Ptr", ppctlib ; ICreateTypeLib** out
, "Int") ; return: HRESULT●CreateTypeLib(syskind, szFile, ppctlib) = DLL("OLEAUT32.dll", "int CreateTypeLib(int, char*, void*)")
# 呼び出し: CreateTypeLib(syskind, szFile, ppctlib)
# syskind : SYSKIND -> "int"
# szFile : LPCWSTR -> "char*"
# ppctlib : ICreateTypeLib** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。