ホーム › System.Console › GetConsoleAliasesLengthW
GetConsoleAliasesLengthW
関数指定した実行ファイルの全エイリアスの合計バイト長を取得する(Unicode版)。
シグネチャ
// KERNEL32.dll (Unicode / -W)
#include <windows.h>
DWORD GetConsoleAliasesLengthW(
LPWSTR ExeName
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ExeName | LPWSTR | in |
戻り値の型: DWORD
各言語での呼び出し定義
// KERNEL32.dll (Unicode / -W)
#include <windows.h>
DWORD GetConsoleAliasesLengthW(
LPWSTR ExeName
);[DllImport("KERNEL32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint GetConsoleAliasesLengthW(
[MarshalAs(UnmanagedType.LPWStr)] string ExeName // LPWSTR
);<DllImport("KERNEL32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function GetConsoleAliasesLengthW(
<MarshalAs(UnmanagedType.LPWStr)> ExeName As String ' LPWSTR
) As UInteger
End Function' ExeName : LPWSTR
Declare PtrSafe Function GetConsoleAliasesLengthW Lib "kernel32" ( _
ByVal ExeName As LongPtr) As Long
' 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
GetConsoleAliasesLengthW = ctypes.windll.kernel32.GetConsoleAliasesLengthW
GetConsoleAliasesLengthW.restype = wintypes.DWORD
GetConsoleAliasesLengthW.argtypes = [
wintypes.LPCWSTR, # ExeName : LPWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
GetConsoleAliasesLengthW = Fiddle::Function.new(
lib['GetConsoleAliasesLengthW'],
[
Fiddle::TYPE_VOIDP, # ExeName : LPWSTR
],
-Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "kernel32")]
extern "system" {
fn GetConsoleAliasesLengthW(
ExeName: *mut u16 // LPWSTR
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll", CharSet = CharSet.Unicode)]
public static extern uint GetConsoleAliasesLengthW([MarshalAs(UnmanagedType.LPWStr)] string ExeName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_GetConsoleAliasesLengthW' -Namespace Win32 -PassThru
# $api::GetConsoleAliasesLengthW(ExeName)#uselib "KERNEL32.dll"
#func global GetConsoleAliasesLengthW "GetConsoleAliasesLengthW" wptr
; GetConsoleAliasesLengthW ExeName ; 戻り値は stat
; ExeName : LPWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global GetConsoleAliasesLengthW "GetConsoleAliasesLengthW" wstr
; res = GetConsoleAliasesLengthW(ExeName)
; ExeName : LPWSTR -> "wstr"; DWORD GetConsoleAliasesLengthW(LPWSTR ExeName)
#uselib "KERNEL32.dll"
#cfunc global GetConsoleAliasesLengthW "GetConsoleAliasesLengthW" wstr
; res = GetConsoleAliasesLengthW(ExeName)
; ExeName : LPWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procGetConsoleAliasesLengthW = kernel32.NewProc("GetConsoleAliasesLengthW")
)
// ExeName (LPWSTR)
r1, _, err := procGetConsoleAliasesLengthW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(ExeName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction GetConsoleAliasesLengthW(
ExeName: PWideChar // LPWSTR
): DWORD; stdcall;
external 'KERNEL32.dll' name 'GetConsoleAliasesLengthW';result := DllCall("KERNEL32\GetConsoleAliasesLengthW"
, "WStr", ExeName ; LPWSTR
, "UInt") ; return: DWORD●GetConsoleAliasesLengthW(ExeName) = DLL("KERNEL32.dll", "dword GetConsoleAliasesLengthW(char*)")
# 呼び出し: GetConsoleAliasesLengthW(ExeName)
# ExeName : LPWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。