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

RecycleSurrogate

関数
指定した理由コードでサロゲートプロセスのリサイクルを要求する。
DLLcomsvcs.dll呼出規約cdecl対応OSWindows 2000 以降

シグネチャ

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

HRESULT RecycleSurrogate(
    INT lReasonCode
);

パラメーター

名前方向
lReasonCodeINTin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

RecycleSurrogate = ctypes.cdll.comsvcs.RecycleSurrogate
RecycleSurrogate.restype = ctypes.c_int
RecycleSurrogate.argtypes = [
    ctypes.c_int,  # lReasonCode : INT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	comsvcs = windows.NewLazySystemDLL("comsvcs.dll")
	procRecycleSurrogate = comsvcs.NewProc("RecycleSurrogate")
)

// lReasonCode (INT)
r1, _, err := procRecycleSurrogate.Call(
	uintptr(lReasonCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function RecycleSurrogate(
  lReasonCode: Integer   // INT
): Integer; cdecl;
  external 'comsvcs.dll' name 'RecycleSurrogate';
result := DllCall("comsvcs\RecycleSurrogate"
    , "Int", lReasonCode   ; INT
    , "Cdecl Int")   ; return: HRESULT
●RecycleSurrogate(lReasonCode) = DLL("comsvcs.dll", "int RecycleSurrogate(int)")
# 呼び出し: RecycleSurrogate(lReasonCode)
# lReasonCode : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。