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

ExpungeConsoleCommandHistoryA

関数
指定した実行ファイルのコンソールコマンド履歴を消去する(ANSI版)。
DLLKERNEL32.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

// KERNEL32.dll  (ANSI / -A)
#include <windows.h>

void ExpungeConsoleCommandHistoryA(
    LPSTR ExeName
);

パラメーター

名前方向
ExeNameLPSTRin

戻り値の型: void

各言語での呼び出し定義

// KERNEL32.dll  (ANSI / -A)
#include <windows.h>

void ExpungeConsoleCommandHistoryA(
    LPSTR ExeName
);
[DllImport("KERNEL32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern void ExpungeConsoleCommandHistoryA(
    [MarshalAs(UnmanagedType.LPStr)] string ExeName   // LPSTR
);
<DllImport("KERNEL32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Sub ExpungeConsoleCommandHistoryA(
    <MarshalAs(UnmanagedType.LPStr)> ExeName As String   ' LPSTR
)
End Sub
' ExeName : LPSTR
Declare PtrSafe Sub ExpungeConsoleCommandHistoryA Lib "kernel32" ( _
    ByVal ExeName As String)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ExpungeConsoleCommandHistoryA = ctypes.windll.kernel32.ExpungeConsoleCommandHistoryA
ExpungeConsoleCommandHistoryA.restype = None
ExpungeConsoleCommandHistoryA.argtypes = [
    wintypes.LPCSTR,  # ExeName : LPSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
ExpungeConsoleCommandHistoryA = Fiddle::Function.new(
  lib['ExpungeConsoleCommandHistoryA'],
  [
    Fiddle::TYPE_VOIDP,  # ExeName : LPSTR
  ],
  Fiddle::TYPE_VOID)
#[link(name = "kernel32")]
extern "system" {
    fn ExpungeConsoleCommandHistoryA(
        ExeName: *mut u8  // LPSTR
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("KERNEL32.dll", CharSet = CharSet.Ansi)]
public static extern void ExpungeConsoleCommandHistoryA([MarshalAs(UnmanagedType.LPStr)] string ExeName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_ExpungeConsoleCommandHistoryA' -Namespace Win32 -PassThru
# $api::ExpungeConsoleCommandHistoryA(ExeName)
#uselib "KERNEL32.dll"
#func global ExpungeConsoleCommandHistoryA "ExpungeConsoleCommandHistoryA" sptr
; ExpungeConsoleCommandHistoryA ExeName
; ExeName : LPSTR -> "sptr"
#uselib "KERNEL32.dll"
#func global ExpungeConsoleCommandHistoryA "ExpungeConsoleCommandHistoryA" str
; ExpungeConsoleCommandHistoryA ExeName
; ExeName : LPSTR -> "str"
; void ExpungeConsoleCommandHistoryA(LPSTR ExeName)
#uselib "KERNEL32.dll"
#func global ExpungeConsoleCommandHistoryA "ExpungeConsoleCommandHistoryA" str
; ExpungeConsoleCommandHistoryA ExeName
; ExeName : LPSTR -> "str"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procExpungeConsoleCommandHistoryA = kernel32.NewProc("ExpungeConsoleCommandHistoryA")
)

// ExeName (LPSTR)
r1, _, err := procExpungeConsoleCommandHistoryA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(ExeName))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure ExpungeConsoleCommandHistoryA(
  ExeName: PAnsiChar   // LPSTR
); stdcall;
  external 'KERNEL32.dll' name 'ExpungeConsoleCommandHistoryA';
result := DllCall("KERNEL32\ExpungeConsoleCommandHistoryA"
    , "AStr", ExeName   ; LPSTR
    , "Int")   ; return: void
●ExpungeConsoleCommandHistoryA(ExeName) = DLL("KERNEL32.dll", "int ExpungeConsoleCommandHistoryA(char*)")
# 呼び出し: ExpungeConsoleCommandHistoryA(ExeName)
# ExeName : LPSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。