ホーム › NetworkManagement.IpHelper › SetCurrentThreadCompartmentScope
SetCurrentThreadCompartmentScope
関数現在のスレッドのコンパートメントスコープを設定する。
シグネチャ
// IPHLPAPI.dll
#include <windows.h>
WIN32_ERROR SetCurrentThreadCompartmentScope(
DWORD CompartmentScope
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| CompartmentScope | DWORD | in |
戻り値の型: WIN32_ERROR
各言語での呼び出し定義
// IPHLPAPI.dll
#include <windows.h>
WIN32_ERROR SetCurrentThreadCompartmentScope(
DWORD CompartmentScope
);[DllImport("IPHLPAPI.dll", ExactSpelling = true)]
static extern uint SetCurrentThreadCompartmentScope(
uint CompartmentScope // DWORD
);<DllImport("IPHLPAPI.dll", ExactSpelling:=True)>
Public Shared Function SetCurrentThreadCompartmentScope(
CompartmentScope As UInteger ' DWORD
) As UInteger
End Function' CompartmentScope : DWORD
Declare PtrSafe Function SetCurrentThreadCompartmentScope Lib "iphlpapi" ( _
ByVal CompartmentScope As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetCurrentThreadCompartmentScope = ctypes.windll.iphlpapi.SetCurrentThreadCompartmentScope
SetCurrentThreadCompartmentScope.restype = wintypes.DWORD
SetCurrentThreadCompartmentScope.argtypes = [
wintypes.DWORD, # CompartmentScope : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('IPHLPAPI.dll')
SetCurrentThreadCompartmentScope = Fiddle::Function.new(
lib['SetCurrentThreadCompartmentScope'],
[
-Fiddle::TYPE_INT, # CompartmentScope : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "iphlpapi")]
extern "system" {
fn SetCurrentThreadCompartmentScope(
CompartmentScope: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("IPHLPAPI.dll")]
public static extern uint SetCurrentThreadCompartmentScope(uint CompartmentScope);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IPHLPAPI_SetCurrentThreadCompartmentScope' -Namespace Win32 -PassThru
# $api::SetCurrentThreadCompartmentScope(CompartmentScope)#uselib "IPHLPAPI.dll"
#func global SetCurrentThreadCompartmentScope "SetCurrentThreadCompartmentScope" sptr
; SetCurrentThreadCompartmentScope CompartmentScope ; 戻り値は stat
; CompartmentScope : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "IPHLPAPI.dll"
#cfunc global SetCurrentThreadCompartmentScope "SetCurrentThreadCompartmentScope" int
; res = SetCurrentThreadCompartmentScope(CompartmentScope)
; CompartmentScope : DWORD -> "int"; WIN32_ERROR SetCurrentThreadCompartmentScope(DWORD CompartmentScope)
#uselib "IPHLPAPI.dll"
#cfunc global SetCurrentThreadCompartmentScope "SetCurrentThreadCompartmentScope" int
; res = SetCurrentThreadCompartmentScope(CompartmentScope)
; CompartmentScope : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
iphlpapi = windows.NewLazySystemDLL("IPHLPAPI.dll")
procSetCurrentThreadCompartmentScope = iphlpapi.NewProc("SetCurrentThreadCompartmentScope")
)
// CompartmentScope (DWORD)
r1, _, err := procSetCurrentThreadCompartmentScope.Call(
uintptr(CompartmentScope),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // WIN32_ERRORfunction SetCurrentThreadCompartmentScope(
CompartmentScope: DWORD // DWORD
): DWORD; stdcall;
external 'IPHLPAPI.dll' name 'SetCurrentThreadCompartmentScope';result := DllCall("IPHLPAPI\SetCurrentThreadCompartmentScope"
, "UInt", CompartmentScope ; DWORD
, "UInt") ; return: WIN32_ERROR●SetCurrentThreadCompartmentScope(CompartmentScope) = DLL("IPHLPAPI.dll", "dword SetCurrentThreadCompartmentScope(dword)")
# 呼び出し: SetCurrentThreadCompartmentScope(CompartmentScope)
# CompartmentScope : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。