ホーム › System.Console › ExpungeConsoleCommandHistoryW
ExpungeConsoleCommandHistoryW
関数指定した実行ファイルのコンソールコマンド履歴を消去する(Unicode版)。
シグネチャ
// KERNEL32.dll (Unicode / -W)
#include <windows.h>
void ExpungeConsoleCommandHistoryW(
LPWSTR ExeName
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ExeName | LPWSTR | in |
戻り値の型: void
各言語での呼び出し定義
// KERNEL32.dll (Unicode / -W)
#include <windows.h>
void ExpungeConsoleCommandHistoryW(
LPWSTR ExeName
);[DllImport("KERNEL32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern void ExpungeConsoleCommandHistoryW(
[MarshalAs(UnmanagedType.LPWStr)] string ExeName // LPWSTR
);<DllImport("KERNEL32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Sub ExpungeConsoleCommandHistoryW(
<MarshalAs(UnmanagedType.LPWStr)> ExeName As String ' LPWSTR
)
End Sub' ExeName : LPWSTR
Declare PtrSafe Sub ExpungeConsoleCommandHistoryW Lib "kernel32" ( _
ByVal ExeName As LongPtr)
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ExpungeConsoleCommandHistoryW = ctypes.windll.kernel32.ExpungeConsoleCommandHistoryW
ExpungeConsoleCommandHistoryW.restype = None
ExpungeConsoleCommandHistoryW.argtypes = [
wintypes.LPCWSTR, # ExeName : LPWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
ExpungeConsoleCommandHistoryW = Fiddle::Function.new(
lib['ExpungeConsoleCommandHistoryW'],
[
Fiddle::TYPE_VOIDP, # ExeName : LPWSTR
],
Fiddle::TYPE_VOID)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "kernel32")]
extern "system" {
fn ExpungeConsoleCommandHistoryW(
ExeName: *mut u16 // LPWSTR
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll", CharSet = CharSet.Unicode)]
public static extern void ExpungeConsoleCommandHistoryW([MarshalAs(UnmanagedType.LPWStr)] string ExeName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_ExpungeConsoleCommandHistoryW' -Namespace Win32 -PassThru
# $api::ExpungeConsoleCommandHistoryW(ExeName)#uselib "KERNEL32.dll"
#func global ExpungeConsoleCommandHistoryW "ExpungeConsoleCommandHistoryW" wptr
; ExpungeConsoleCommandHistoryW ExeName
; ExeName : LPWSTR -> "wptr"#uselib "KERNEL32.dll"
#func global ExpungeConsoleCommandHistoryW "ExpungeConsoleCommandHistoryW" wstr
; ExpungeConsoleCommandHistoryW ExeName
; ExeName : LPWSTR -> "wstr"; void ExpungeConsoleCommandHistoryW(LPWSTR ExeName)
#uselib "KERNEL32.dll"
#func global ExpungeConsoleCommandHistoryW "ExpungeConsoleCommandHistoryW" wstr
; ExpungeConsoleCommandHistoryW ExeName
; ExeName : LPWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procExpungeConsoleCommandHistoryW = kernel32.NewProc("ExpungeConsoleCommandHistoryW")
)
// ExeName (LPWSTR)
r1, _, err := procExpungeConsoleCommandHistoryW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(ExeName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure ExpungeConsoleCommandHistoryW(
ExeName: PWideChar // LPWSTR
); stdcall;
external 'KERNEL32.dll' name 'ExpungeConsoleCommandHistoryW';result := DllCall("KERNEL32\ExpungeConsoleCommandHistoryW"
, "WStr", ExeName ; LPWSTR
, "Int") ; return: void●ExpungeConsoleCommandHistoryW(ExeName) = DLL("KERNEL32.dll", "int ExpungeConsoleCommandHistoryW(char*)")
# 呼び出し: ExpungeConsoleCommandHistoryW(ExeName)
# ExeName : LPWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。