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