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