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

WTSStopRemoteControlSession

関数
指定セッションのリモート制御セッションを停止する。
DLLWTSAPI32.dll呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

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

BOOL WTSStopRemoteControlSession(
    DWORD LogonId
);

パラメーター

名前方向
LogonIdDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

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

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

WTSStopRemoteControlSession = ctypes.windll.wtsapi32.WTSStopRemoteControlSession
WTSStopRemoteControlSession.restype = wintypes.BOOL
WTSStopRemoteControlSession.argtypes = [
    wintypes.DWORD,  # LogonId : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	wtsapi32 = windows.NewLazySystemDLL("WTSAPI32.dll")
	procWTSStopRemoteControlSession = wtsapi32.NewProc("WTSStopRemoteControlSession")
)

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