ホーム › System.Ole › UnRegisterTypeLibForUser
UnRegisterTypeLibForUser
関数ユーザー単位で登録したタイプライブラリの登録を解除する。
シグネチャ
// OLEAUT32.dll
#include <windows.h>
HRESULT UnRegisterTypeLibForUser(
const GUID* libID,
WORD wMajorVerNum,
WORD wMinorVerNum,
DWORD lcid,
SYSKIND syskind
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| libID | GUID* | in | ライブラリの GUID。 |
| wMajorVerNum | WORD | in | タイプライブラリのメジャーバージョン。 |
| wMinorVerNum | WORD | in | タイプライブラリのマイナーバージョン。 |
| lcid | DWORD | in | ロケール識別子。 |
| syskind | SYSKIND | in | 対象のオペレーティングシステム。 |
戻り値の型: HRESULT
公式ドキュメント
RegisterTypeLibForUser を使用して登録されたタイプライブラリ情報を削除します。
戻り値
この関数は次のいずれかの値を返すことがあります。
| 戻り値 | 説明 |
|---|---|
| 成功しました。 | |
| 1 つ以上の引数が無効です。 | |
| 操作を完了するためのメモリが不足しています。 | |
| 関数がファイルに書き込めませんでした。 | |
| システムの登録データベースを開けませんでした。 | |
| タイプライブラリを開けませんでした。 |
解説(Remarks)
RegisterTypeLibForUser 関数を使用して登録されたタイプライブラリのタイプライブラリ情報を削除するには、UnRegisterTypeLibForUser を使用します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// OLEAUT32.dll
#include <windows.h>
HRESULT UnRegisterTypeLibForUser(
const GUID* libID,
WORD wMajorVerNum,
WORD wMinorVerNum,
DWORD lcid,
SYSKIND syskind
);[DllImport("OLEAUT32.dll", ExactSpelling = true)]
static extern int UnRegisterTypeLibForUser(
ref Guid libID, // GUID*
ushort wMajorVerNum, // WORD
ushort wMinorVerNum, // WORD
uint lcid, // DWORD
int syskind // SYSKIND
);<DllImport("OLEAUT32.dll", ExactSpelling:=True)>
Public Shared Function UnRegisterTypeLibForUser(
ByRef libID As Guid, ' GUID*
wMajorVerNum As UShort, ' WORD
wMinorVerNum As UShort, ' WORD
lcid As UInteger, ' DWORD
syskind As Integer ' SYSKIND
) As Integer
End Function' libID : GUID*
' wMajorVerNum : WORD
' wMinorVerNum : WORD
' lcid : DWORD
' syskind : SYSKIND
Declare PtrSafe Function UnRegisterTypeLibForUser Lib "oleaut32" ( _
ByVal libID As LongPtr, _
ByVal wMajorVerNum As Integer, _
ByVal wMinorVerNum As Integer, _
ByVal lcid As Long, _
ByVal syskind As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
UnRegisterTypeLibForUser = ctypes.windll.oleaut32.UnRegisterTypeLibForUser
UnRegisterTypeLibForUser.restype = ctypes.c_int
UnRegisterTypeLibForUser.argtypes = [
ctypes.c_void_p, # libID : GUID*
ctypes.c_ushort, # wMajorVerNum : WORD
ctypes.c_ushort, # wMinorVerNum : WORD
wintypes.DWORD, # lcid : DWORD
ctypes.c_int, # syskind : SYSKIND
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLEAUT32.dll')
UnRegisterTypeLibForUser = Fiddle::Function.new(
lib['UnRegisterTypeLibForUser'],
[
Fiddle::TYPE_VOIDP, # libID : GUID*
-Fiddle::TYPE_SHORT, # wMajorVerNum : WORD
-Fiddle::TYPE_SHORT, # wMinorVerNum : WORD
-Fiddle::TYPE_INT, # lcid : DWORD
Fiddle::TYPE_INT, # syskind : SYSKIND
],
Fiddle::TYPE_INT)#[link(name = "oleaut32")]
extern "system" {
fn UnRegisterTypeLibForUser(
libID: *const GUID, // GUID*
wMajorVerNum: u16, // WORD
wMinorVerNum: u16, // WORD
lcid: u32, // DWORD
syskind: i32 // SYSKIND
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLEAUT32.dll")]
public static extern int UnRegisterTypeLibForUser(ref Guid libID, ushort wMajorVerNum, ushort wMinorVerNum, uint lcid, int syskind);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLEAUT32_UnRegisterTypeLibForUser' -Namespace Win32 -PassThru
# $api::UnRegisterTypeLibForUser(libID, wMajorVerNum, wMinorVerNum, lcid, syskind)#uselib "OLEAUT32.dll"
#func global UnRegisterTypeLibForUser "UnRegisterTypeLibForUser" sptr, sptr, sptr, sptr, sptr
; UnRegisterTypeLibForUser varptr(libID), wMajorVerNum, wMinorVerNum, lcid, syskind ; 戻り値は stat
; libID : GUID* -> "sptr"
; wMajorVerNum : WORD -> "sptr"
; wMinorVerNum : WORD -> "sptr"
; lcid : DWORD -> "sptr"
; syskind : SYSKIND -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "OLEAUT32.dll" #cfunc global UnRegisterTypeLibForUser "UnRegisterTypeLibForUser" var, int, int, int, int ; res = UnRegisterTypeLibForUser(libID, wMajorVerNum, wMinorVerNum, lcid, syskind) ; libID : GUID* -> "var" ; wMajorVerNum : WORD -> "int" ; wMinorVerNum : WORD -> "int" ; lcid : DWORD -> "int" ; syskind : SYSKIND -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "OLEAUT32.dll" #cfunc global UnRegisterTypeLibForUser "UnRegisterTypeLibForUser" sptr, int, int, int, int ; res = UnRegisterTypeLibForUser(varptr(libID), wMajorVerNum, wMinorVerNum, lcid, syskind) ; libID : GUID* -> "sptr" ; wMajorVerNum : WORD -> "int" ; wMinorVerNum : WORD -> "int" ; lcid : DWORD -> "int" ; syskind : SYSKIND -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT UnRegisterTypeLibForUser(GUID* libID, WORD wMajorVerNum, WORD wMinorVerNum, DWORD lcid, SYSKIND syskind) #uselib "OLEAUT32.dll" #cfunc global UnRegisterTypeLibForUser "UnRegisterTypeLibForUser" var, int, int, int, int ; res = UnRegisterTypeLibForUser(libID, wMajorVerNum, wMinorVerNum, lcid, syskind) ; libID : GUID* -> "var" ; wMajorVerNum : WORD -> "int" ; wMinorVerNum : WORD -> "int" ; lcid : DWORD -> "int" ; syskind : SYSKIND -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT UnRegisterTypeLibForUser(GUID* libID, WORD wMajorVerNum, WORD wMinorVerNum, DWORD lcid, SYSKIND syskind) #uselib "OLEAUT32.dll" #cfunc global UnRegisterTypeLibForUser "UnRegisterTypeLibForUser" intptr, int, int, int, int ; res = UnRegisterTypeLibForUser(varptr(libID), wMajorVerNum, wMinorVerNum, lcid, syskind) ; libID : GUID* -> "intptr" ; wMajorVerNum : WORD -> "int" ; wMinorVerNum : WORD -> "int" ; lcid : DWORD -> "int" ; syskind : SYSKIND -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
oleaut32 = windows.NewLazySystemDLL("OLEAUT32.dll")
procUnRegisterTypeLibForUser = oleaut32.NewProc("UnRegisterTypeLibForUser")
)
// libID (GUID*), wMajorVerNum (WORD), wMinorVerNum (WORD), lcid (DWORD), syskind (SYSKIND)
r1, _, err := procUnRegisterTypeLibForUser.Call(
uintptr(libID),
uintptr(wMajorVerNum),
uintptr(wMinorVerNum),
uintptr(lcid),
uintptr(syskind),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction UnRegisterTypeLibForUser(
libID: PGUID; // GUID*
wMajorVerNum: Word; // WORD
wMinorVerNum: Word; // WORD
lcid: DWORD; // DWORD
syskind: Integer // SYSKIND
): Integer; stdcall;
external 'OLEAUT32.dll' name 'UnRegisterTypeLibForUser';result := DllCall("OLEAUT32\UnRegisterTypeLibForUser"
, "Ptr", libID ; GUID*
, "UShort", wMajorVerNum ; WORD
, "UShort", wMinorVerNum ; WORD
, "UInt", lcid ; DWORD
, "Int", syskind ; SYSKIND
, "Int") ; return: HRESULT●UnRegisterTypeLibForUser(libID, wMajorVerNum, wMinorVerNum, lcid, syskind) = DLL("OLEAUT32.dll", "int UnRegisterTypeLibForUser(void*, int, int, dword, int)")
# 呼び出し: UnRegisterTypeLibForUser(libID, wMajorVerNum, wMinorVerNum, lcid, syskind)
# libID : GUID* -> "void*"
# wMajorVerNum : WORD -> "int"
# wMinorVerNum : WORD -> "int"
# lcid : DWORD -> "dword"
# syskind : SYSKIND -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "oleaut32" fn UnRegisterTypeLibForUser(
libID: [*c]GUID, // GUID*
wMajorVerNum: u16, // WORD
wMinorVerNum: u16, // WORD
lcid: u32, // DWORD
syskind: i32 // SYSKIND
) callconv(std.os.windows.WINAPI) i32;proc UnRegisterTypeLibForUser(
libID: ptr GUID, # GUID*
wMajorVerNum: uint16, # WORD
wMinorVerNum: uint16, # WORD
lcid: uint32, # DWORD
syskind: int32 # SYSKIND
): int32 {.importc: "UnRegisterTypeLibForUser", stdcall, dynlib: "OLEAUT32.dll".}pragma(lib, "oleaut32");
extern(Windows)
int UnRegisterTypeLibForUser(
GUID* libID, // GUID*
ushort wMajorVerNum, // WORD
ushort wMinorVerNum, // WORD
uint lcid, // DWORD
int syskind // SYSKIND
);ccall((:UnRegisterTypeLibForUser, "OLEAUT32.dll"), stdcall, Int32,
(Ptr{GUID}, UInt16, UInt16, UInt32, Int32),
libID, wMajorVerNum, wMinorVerNum, lcid, syskind)
# libID : GUID* -> Ptr{GUID}
# wMajorVerNum : WORD -> UInt16
# wMinorVerNum : WORD -> UInt16
# lcid : DWORD -> UInt32
# syskind : SYSKIND -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t UnRegisterTypeLibForUser(
void* libID,
uint16_t wMajorVerNum,
uint16_t wMinorVerNum,
uint32_t lcid,
int32_t syskind);
]]
local oleaut32 = ffi.load("oleaut32")
-- oleaut32.UnRegisterTypeLibForUser(libID, wMajorVerNum, wMinorVerNum, lcid, syskind)
-- libID : GUID*
-- wMajorVerNum : WORD
-- wMinorVerNum : WORD
-- lcid : DWORD
-- syskind : SYSKIND
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('OLEAUT32.dll');
const UnRegisterTypeLibForUser = lib.func('__stdcall', 'UnRegisterTypeLibForUser', 'int32_t', ['void *', 'uint16_t', 'uint16_t', 'uint32_t', 'int32_t']);
// UnRegisterTypeLibForUser(libID, wMajorVerNum, wMinorVerNum, lcid, syskind)
// libID : GUID* -> 'void *'
// wMajorVerNum : WORD -> 'uint16_t'
// wMinorVerNum : WORD -> 'uint16_t'
// lcid : DWORD -> 'uint32_t'
// syskind : SYSKIND -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("OLEAUT32.dll", {
UnRegisterTypeLibForUser: { parameters: ["pointer", "u16", "u16", "u32", "i32"], result: "i32" },
});
// lib.symbols.UnRegisterTypeLibForUser(libID, wMajorVerNum, wMinorVerNum, lcid, syskind)
// libID : GUID* -> "pointer"
// wMajorVerNum : WORD -> "u16"
// wMinorVerNum : WORD -> "u16"
// lcid : DWORD -> "u32"
// syskind : SYSKIND -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t UnRegisterTypeLibForUser(
void* libID,
uint16_t wMajorVerNum,
uint16_t wMinorVerNum,
uint32_t lcid,
int32_t syskind);
C, "OLEAUT32.dll");
// $ffi->UnRegisterTypeLibForUser(libID, wMajorVerNum, wMinorVerNum, lcid, syskind);
// libID : GUID*
// wMajorVerNum : WORD
// wMinorVerNum : WORD
// lcid : DWORD
// syskind : SYSKIND
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Oleaut32 extends StdCallLibrary {
Oleaut32 INSTANCE = Native.load("oleaut32", Oleaut32.class);
int UnRegisterTypeLibForUser(
Pointer libID, // GUID*
short wMajorVerNum, // WORD
short wMinorVerNum, // WORD
int lcid, // DWORD
int syskind // SYSKIND
);
}@[Link("oleaut32")]
lib LibOLEAUT32
fun UnRegisterTypeLibForUser = UnRegisterTypeLibForUser(
libID : GUID*, # GUID*
wMajorVerNum : UInt16, # WORD
wMinorVerNum : UInt16, # WORD
lcid : UInt32, # DWORD
syskind : Int32 # SYSKIND
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef UnRegisterTypeLibForUserNative = Int32 Function(Pointer<Void>, Uint16, Uint16, Uint32, Int32);
typedef UnRegisterTypeLibForUserDart = int Function(Pointer<Void>, int, int, int, int);
final UnRegisterTypeLibForUser = DynamicLibrary.open('OLEAUT32.dll')
.lookupFunction<UnRegisterTypeLibForUserNative, UnRegisterTypeLibForUserDart>('UnRegisterTypeLibForUser');
// libID : GUID* -> Pointer<Void>
// wMajorVerNum : WORD -> Uint16
// wMinorVerNum : WORD -> Uint16
// lcid : DWORD -> Uint32
// syskind : SYSKIND -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function UnRegisterTypeLibForUser(
libID: PGUID; // GUID*
wMajorVerNum: Word; // WORD
wMinorVerNum: Word; // WORD
lcid: DWORD; // DWORD
syskind: Integer // SYSKIND
): Integer; stdcall;
external 'OLEAUT32.dll' name 'UnRegisterTypeLibForUser';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "UnRegisterTypeLibForUser"
c_UnRegisterTypeLibForUser :: Ptr () -> Word16 -> Word16 -> Word32 -> Int32 -> IO Int32
-- libID : GUID* -> Ptr ()
-- wMajorVerNum : WORD -> Word16
-- wMinorVerNum : WORD -> Word16
-- lcid : DWORD -> Word32
-- syskind : SYSKIND -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let unregistertypelibforuser =
foreign "UnRegisterTypeLibForUser"
((ptr void) @-> uint16_t @-> uint16_t @-> uint32_t @-> int32_t @-> returning int32_t)
(* libID : GUID* -> (ptr void) *)
(* wMajorVerNum : WORD -> uint16_t *)
(* wMinorVerNum : WORD -> uint16_t *)
(* lcid : DWORD -> uint32_t *)
(* syskind : SYSKIND -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library oleaut32 (t "OLEAUT32.dll"))
(cffi:use-foreign-library oleaut32)
(cffi:defcfun ("UnRegisterTypeLibForUser" un-register-type-lib-for-user :convention :stdcall) :int32
(lib-id :pointer) ; GUID*
(w-major-ver-num :uint16) ; WORD
(w-minor-ver-num :uint16) ; WORD
(lcid :uint32) ; DWORD
(syskind :int32)) ; SYSKIND
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $UnRegisterTypeLibForUser = Win32::API::More->new('OLEAUT32',
'int UnRegisterTypeLibForUser(LPVOID libID, WORD wMajorVerNum, WORD wMinorVerNum, DWORD lcid, int syskind)');
# my $ret = $UnRegisterTypeLibForUser->Call($libID, $wMajorVerNum, $wMinorVerNum, $lcid, $syskind);
# libID : GUID* -> LPVOID
# wMajorVerNum : WORD -> WORD
# wMinorVerNum : WORD -> WORD
# lcid : DWORD -> DWORD
# syskind : SYSKIND -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型