ホーム › System.ApplicationInstallationAndServicing › DeactivateActCtx
DeactivateActCtx
関数有効化したアクティベーションコンテキストを無効化する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL DeactivateActCtx(
DWORD dwFlags,
UINT_PTR ulCookie
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| dwFlags | DWORD | in |
| ulCookie | UINT_PTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL DeactivateActCtx(
DWORD dwFlags,
UINT_PTR ulCookie
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool DeactivateActCtx(
uint dwFlags, // DWORD
UIntPtr ulCookie // UINT_PTR
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function DeactivateActCtx(
dwFlags As UInteger, ' DWORD
ulCookie As UIntPtr ' UINT_PTR
) As Boolean
End Function' dwFlags : DWORD
' ulCookie : UINT_PTR
Declare PtrSafe Function DeactivateActCtx Lib "kernel32" ( _
ByVal dwFlags As Long, _
ByVal ulCookie As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DeactivateActCtx = ctypes.windll.kernel32.DeactivateActCtx
DeactivateActCtx.restype = wintypes.BOOL
DeactivateActCtx.argtypes = [
wintypes.DWORD, # dwFlags : DWORD
ctypes.c_size_t, # ulCookie : UINT_PTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
DeactivateActCtx = Fiddle::Function.new(
lib['DeactivateActCtx'],
[
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_UINTPTR_T, # ulCookie : UINT_PTR
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn DeactivateActCtx(
dwFlags: u32, // DWORD
ulCookie: usize // UINT_PTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern bool DeactivateActCtx(uint dwFlags, UIntPtr ulCookie);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_DeactivateActCtx' -Namespace Win32 -PassThru
# $api::DeactivateActCtx(dwFlags, ulCookie)#uselib "KERNEL32.dll"
#func global DeactivateActCtx "DeactivateActCtx" sptr, sptr
; DeactivateActCtx dwFlags, ulCookie ; 戻り値は stat
; dwFlags : DWORD -> "sptr"
; ulCookie : UINT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global DeactivateActCtx "DeactivateActCtx" int, sptr
; res = DeactivateActCtx(dwFlags, ulCookie)
; dwFlags : DWORD -> "int"
; ulCookie : UINT_PTR -> "sptr"; BOOL DeactivateActCtx(DWORD dwFlags, UINT_PTR ulCookie)
#uselib "KERNEL32.dll"
#cfunc global DeactivateActCtx "DeactivateActCtx" int, intptr
; res = DeactivateActCtx(dwFlags, ulCookie)
; dwFlags : DWORD -> "int"
; ulCookie : UINT_PTR -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procDeactivateActCtx = kernel32.NewProc("DeactivateActCtx")
)
// dwFlags (DWORD), ulCookie (UINT_PTR)
r1, _, err := procDeactivateActCtx.Call(
uintptr(dwFlags),
uintptr(ulCookie),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction DeactivateActCtx(
dwFlags: DWORD; // DWORD
ulCookie: NativeUInt // UINT_PTR
): BOOL; stdcall;
external 'KERNEL32.dll' name 'DeactivateActCtx';result := DllCall("KERNEL32\DeactivateActCtx"
, "UInt", dwFlags ; DWORD
, "UPtr", ulCookie ; UINT_PTR
, "Int") ; return: BOOL●DeactivateActCtx(dwFlags, ulCookie) = DLL("KERNEL32.dll", "bool DeactivateActCtx(dword, int)")
# 呼び出し: DeactivateActCtx(dwFlags, ulCookie)
# dwFlags : DWORD -> "dword"
# ulCookie : UINT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。