ホーム › System.ApplicationInstallationAndServicing › GetCurrentActCtx
GetCurrentActCtx
関数現在有効なアクティベーションコンテキストのハンドルを取得する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL GetCurrentActCtx(
HANDLE* lphActCtx
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lphActCtx | HANDLE* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL GetCurrentActCtx(
HANDLE* lphActCtx
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool GetCurrentActCtx(
IntPtr lphActCtx // HANDLE* out
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetCurrentActCtx(
lphActCtx As IntPtr ' HANDLE* out
) As Boolean
End Function' lphActCtx : HANDLE* out
Declare PtrSafe Function GetCurrentActCtx Lib "kernel32" ( _
ByVal lphActCtx As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetCurrentActCtx = ctypes.windll.kernel32.GetCurrentActCtx
GetCurrentActCtx.restype = wintypes.BOOL
GetCurrentActCtx.argtypes = [
ctypes.c_void_p, # lphActCtx : HANDLE* out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
GetCurrentActCtx = Fiddle::Function.new(
lib['GetCurrentActCtx'],
[
Fiddle::TYPE_VOIDP, # lphActCtx : HANDLE* out
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn GetCurrentActCtx(
lphActCtx: *mut *mut core::ffi::c_void // HANDLE* out
) -> 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 GetCurrentActCtx(IntPtr lphActCtx);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_GetCurrentActCtx' -Namespace Win32 -PassThru
# $api::GetCurrentActCtx(lphActCtx)#uselib "KERNEL32.dll"
#func global GetCurrentActCtx "GetCurrentActCtx" sptr
; GetCurrentActCtx lphActCtx ; 戻り値は stat
; lphActCtx : HANDLE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global GetCurrentActCtx "GetCurrentActCtx" sptr
; res = GetCurrentActCtx(lphActCtx)
; lphActCtx : HANDLE* out -> "sptr"; BOOL GetCurrentActCtx(HANDLE* lphActCtx)
#uselib "KERNEL32.dll"
#cfunc global GetCurrentActCtx "GetCurrentActCtx" intptr
; res = GetCurrentActCtx(lphActCtx)
; lphActCtx : HANDLE* out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procGetCurrentActCtx = kernel32.NewProc("GetCurrentActCtx")
)
// lphActCtx (HANDLE* out)
r1, _, err := procGetCurrentActCtx.Call(
uintptr(lphActCtx),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetCurrentActCtx(
lphActCtx: Pointer // HANDLE* out
): BOOL; stdcall;
external 'KERNEL32.dll' name 'GetCurrentActCtx';result := DllCall("KERNEL32\GetCurrentActCtx"
, "Ptr", lphActCtx ; HANDLE* out
, "Int") ; return: BOOL●GetCurrentActCtx(lphActCtx) = DLL("KERNEL32.dll", "bool GetCurrentActCtx(void*)")
# 呼び出し: GetCurrentActCtx(lphActCtx)
# lphActCtx : HANDLE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。