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

WTSEnableChildSessions

関数
子セッション機能の有効・無効を切り替える。
DLLWTSAPI32.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

BOOL WTSEnableChildSessions(
    BOOL bEnable
);

パラメーター

名前方向
bEnableBOOLin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL WTSEnableChildSessions(
    BOOL bEnable
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WTSAPI32.dll", ExactSpelling = true)]
static extern bool WTSEnableChildSessions(
    bool bEnable   // BOOL
);
<DllImport("WTSAPI32.dll", ExactSpelling:=True)>
Public Shared Function WTSEnableChildSessions(
    bEnable As Boolean   ' BOOL
) As Boolean
End Function
' bEnable : BOOL
Declare PtrSafe Function WTSEnableChildSessions Lib "wtsapi32" ( _
    ByVal bEnable As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WTSEnableChildSessions = ctypes.windll.wtsapi32.WTSEnableChildSessions
WTSEnableChildSessions.restype = wintypes.BOOL
WTSEnableChildSessions.argtypes = [
    wintypes.BOOL,  # bEnable : BOOL
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WTSAPI32.dll')
WTSEnableChildSessions = Fiddle::Function.new(
  lib['WTSEnableChildSessions'],
  [
    Fiddle::TYPE_INT,  # bEnable : BOOL
  ],
  Fiddle::TYPE_INT)
#[link(name = "wtsapi32")]
extern "system" {
    fn WTSEnableChildSessions(
        bEnable: i32  // BOOL
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WTSAPI32.dll")]
public static extern bool WTSEnableChildSessions(bool bEnable);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WTSAPI32_WTSEnableChildSessions' -Namespace Win32 -PassThru
# $api::WTSEnableChildSessions(bEnable)
#uselib "WTSAPI32.dll"
#func global WTSEnableChildSessions "WTSEnableChildSessions" sptr
; WTSEnableChildSessions bEnable   ; 戻り値は stat
; bEnable : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WTSAPI32.dll"
#cfunc global WTSEnableChildSessions "WTSEnableChildSessions" int
; res = WTSEnableChildSessions(bEnable)
; bEnable : BOOL -> "int"
; BOOL WTSEnableChildSessions(BOOL bEnable)
#uselib "WTSAPI32.dll"
#cfunc global WTSEnableChildSessions "WTSEnableChildSessions" int
; res = WTSEnableChildSessions(bEnable)
; bEnable : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wtsapi32 = windows.NewLazySystemDLL("WTSAPI32.dll")
	procWTSEnableChildSessions = wtsapi32.NewProc("WTSEnableChildSessions")
)

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