ホーム › UI.WindowsAndMessaging › IsCharAlphaNumericW
IsCharAlphaNumericW
関数文字が英数字かを判定する(Unicode)。
シグネチャ
// USER32.dll (Unicode / -W)
#include <windows.h>
BOOL IsCharAlphaNumericW(
WCHAR ch
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ch | WCHAR | in | 英数字かどうかを判定する対象のワイド文字。 |
戻り値の型: BOOL
各言語での呼び出し定義
// USER32.dll (Unicode / -W)
#include <windows.h>
BOOL IsCharAlphaNumericW(
WCHAR ch
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool IsCharAlphaNumericW(
char ch // WCHAR
);<DllImport("USER32.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function IsCharAlphaNumericW(
ch As Char ' WCHAR
) As Boolean
End Function' ch : WCHAR
Declare PtrSafe Function IsCharAlphaNumericW Lib "user32" ( _
ByVal ch As Integer) 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
IsCharAlphaNumericW = ctypes.windll.user32.IsCharAlphaNumericW
IsCharAlphaNumericW.restype = wintypes.BOOL
IsCharAlphaNumericW.argtypes = [
ctypes.c_wchar, # ch : WCHAR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
IsCharAlphaNumericW = Fiddle::Function.new(
lib['IsCharAlphaNumericW'],
[
Fiddle::TYPE_SHORT, # ch : WCHAR
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "user32")]
extern "system" {
fn IsCharAlphaNumericW(
ch: u16 // WCHAR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool IsCharAlphaNumericW(char ch);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_IsCharAlphaNumericW' -Namespace Win32 -PassThru
# $api::IsCharAlphaNumericW(ch)#uselib "USER32.dll"
#func global IsCharAlphaNumericW "IsCharAlphaNumericW" wptr
; IsCharAlphaNumericW ch ; 戻り値は stat
; ch : WCHAR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global IsCharAlphaNumericW "IsCharAlphaNumericW" int
; res = IsCharAlphaNumericW(ch)
; ch : WCHAR -> "int"; BOOL IsCharAlphaNumericW(WCHAR ch)
#uselib "USER32.dll"
#cfunc global IsCharAlphaNumericW "IsCharAlphaNumericW" int
; res = IsCharAlphaNumericW(ch)
; ch : WCHAR -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procIsCharAlphaNumericW = user32.NewProc("IsCharAlphaNumericW")
)
// ch (WCHAR)
r1, _, err := procIsCharAlphaNumericW.Call(
uintptr(ch),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction IsCharAlphaNumericW(
ch: WideChar // WCHAR
): BOOL; stdcall;
external 'USER32.dll' name 'IsCharAlphaNumericW';result := DllCall("USER32\IsCharAlphaNumericW"
, "Short", ch ; WCHAR
, "Int") ; return: BOOL●IsCharAlphaNumericW(ch) = DLL("USER32.dll", "bool IsCharAlphaNumericW(int)")
# 呼び出し: IsCharAlphaNumericW(ch)
# ch : WCHAR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。