Win32 API 日本語リファレンス
ホームSystem.ComponentServices › CoEnterServiceDomain

CoEnterServiceDomain

関数
指定した構成でCOM+サービスドメインに入る。
DLLcomsvcs.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

// comsvcs.dll
#include <windows.h>

HRESULT CoEnterServiceDomain(
    IUnknown* pConfigObject
);

パラメーター

名前方向
pConfigObjectIUnknown*in

戻り値の型: HRESULT

各言語での呼び出し定義

// comsvcs.dll
#include <windows.h>

HRESULT CoEnterServiceDomain(
    IUnknown* pConfigObject
);
[DllImport("comsvcs.dll", ExactSpelling = true)]
static extern int CoEnterServiceDomain(
    IntPtr pConfigObject   // IUnknown*
);
<DllImport("comsvcs.dll", ExactSpelling:=True)>
Public Shared Function CoEnterServiceDomain(
    pConfigObject As IntPtr   ' IUnknown*
) As Integer
End Function
' pConfigObject : IUnknown*
Declare PtrSafe Function CoEnterServiceDomain Lib "comsvcs" ( _
    ByVal pConfigObject As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CoEnterServiceDomain = ctypes.windll.comsvcs.CoEnterServiceDomain
CoEnterServiceDomain.restype = ctypes.c_int
CoEnterServiceDomain.argtypes = [
    ctypes.c_void_p,  # pConfigObject : IUnknown*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('comsvcs.dll')
CoEnterServiceDomain = Fiddle::Function.new(
  lib['CoEnterServiceDomain'],
  [
    Fiddle::TYPE_VOIDP,  # pConfigObject : IUnknown*
  ],
  Fiddle::TYPE_INT)
#[link(name = "comsvcs")]
extern "system" {
    fn CoEnterServiceDomain(
        pConfigObject: *mut core::ffi::c_void  // IUnknown*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("comsvcs.dll")]
public static extern int CoEnterServiceDomain(IntPtr pConfigObject);
"@
$api = Add-Type -MemberDefinition $sig -Name 'comsvcs_CoEnterServiceDomain' -Namespace Win32 -PassThru
# $api::CoEnterServiceDomain(pConfigObject)
#uselib "comsvcs.dll"
#func global CoEnterServiceDomain "CoEnterServiceDomain" sptr
; CoEnterServiceDomain pConfigObject   ; 戻り値は stat
; pConfigObject : IUnknown* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "comsvcs.dll"
#cfunc global CoEnterServiceDomain "CoEnterServiceDomain" sptr
; res = CoEnterServiceDomain(pConfigObject)
; pConfigObject : IUnknown* -> "sptr"
; HRESULT CoEnterServiceDomain(IUnknown* pConfigObject)
#uselib "comsvcs.dll"
#cfunc global CoEnterServiceDomain "CoEnterServiceDomain" intptr
; res = CoEnterServiceDomain(pConfigObject)
; pConfigObject : IUnknown* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	comsvcs = windows.NewLazySystemDLL("comsvcs.dll")
	procCoEnterServiceDomain = comsvcs.NewProc("CoEnterServiceDomain")
)

// pConfigObject (IUnknown*)
r1, _, err := procCoEnterServiceDomain.Call(
	uintptr(pConfigObject),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function CoEnterServiceDomain(
  pConfigObject: Pointer   // IUnknown*
): Integer; stdcall;
  external 'comsvcs.dll' name 'CoEnterServiceDomain';
result := DllCall("comsvcs\CoEnterServiceDomain"
    , "Ptr", pConfigObject   ; IUnknown*
    , "Int")   ; return: HRESULT
●CoEnterServiceDomain(pConfigObject) = DLL("comsvcs.dll", "int CoEnterServiceDomain(void*)")
# 呼び出し: CoEnterServiceDomain(pConfigObject)
# pConfigObject : IUnknown* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。