ホーム › Globalization › IsDBCSLeadByteEx
IsDBCSLeadByteEx
関数指定コードページでバイトがDBCS先頭バイトか判定する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL IsDBCSLeadByteEx(
DWORD CodePage,
BYTE TestChar
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| CodePage | DWORD | in |
| TestChar | BYTE | in |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL IsDBCSLeadByteEx(
DWORD CodePage,
BYTE TestChar
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool IsDBCSLeadByteEx(
uint CodePage, // DWORD
byte TestChar // BYTE
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function IsDBCSLeadByteEx(
CodePage As UInteger, ' DWORD
TestChar As Byte ' BYTE
) As Boolean
End Function' CodePage : DWORD
' TestChar : BYTE
Declare PtrSafe Function IsDBCSLeadByteEx Lib "kernel32" ( _
ByVal CodePage As Long, _
ByVal TestChar As Byte) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
IsDBCSLeadByteEx = ctypes.windll.kernel32.IsDBCSLeadByteEx
IsDBCSLeadByteEx.restype = wintypes.BOOL
IsDBCSLeadByteEx.argtypes = [
wintypes.DWORD, # CodePage : DWORD
ctypes.c_ubyte, # TestChar : BYTE
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
IsDBCSLeadByteEx = Fiddle::Function.new(
lib['IsDBCSLeadByteEx'],
[
-Fiddle::TYPE_INT, # CodePage : DWORD
-Fiddle::TYPE_CHAR, # TestChar : BYTE
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn IsDBCSLeadByteEx(
CodePage: u32, // DWORD
TestChar: u8 // BYTE
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern bool IsDBCSLeadByteEx(uint CodePage, byte TestChar);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_IsDBCSLeadByteEx' -Namespace Win32 -PassThru
# $api::IsDBCSLeadByteEx(CodePage, TestChar)#uselib "KERNEL32.dll"
#func global IsDBCSLeadByteEx "IsDBCSLeadByteEx" sptr, sptr
; IsDBCSLeadByteEx CodePage, TestChar ; 戻り値は stat
; CodePage : DWORD -> "sptr"
; TestChar : BYTE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global IsDBCSLeadByteEx "IsDBCSLeadByteEx" int, int
; res = IsDBCSLeadByteEx(CodePage, TestChar)
; CodePage : DWORD -> "int"
; TestChar : BYTE -> "int"; BOOL IsDBCSLeadByteEx(DWORD CodePage, BYTE TestChar)
#uselib "KERNEL32.dll"
#cfunc global IsDBCSLeadByteEx "IsDBCSLeadByteEx" int, int
; res = IsDBCSLeadByteEx(CodePage, TestChar)
; CodePage : DWORD -> "int"
; TestChar : BYTE -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procIsDBCSLeadByteEx = kernel32.NewProc("IsDBCSLeadByteEx")
)
// CodePage (DWORD), TestChar (BYTE)
r1, _, err := procIsDBCSLeadByteEx.Call(
uintptr(CodePage),
uintptr(TestChar),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction IsDBCSLeadByteEx(
CodePage: DWORD; // DWORD
TestChar: Byte // BYTE
): BOOL; stdcall;
external 'KERNEL32.dll' name 'IsDBCSLeadByteEx';result := DllCall("KERNEL32\IsDBCSLeadByteEx"
, "UInt", CodePage ; DWORD
, "UChar", TestChar ; BYTE
, "Int") ; return: BOOL●IsDBCSLeadByteEx(CodePage, TestChar) = DLL("KERNEL32.dll", "bool IsDBCSLeadByteEx(dword, byte)")
# 呼び出し: IsDBCSLeadByteEx(CodePage, TestChar)
# CodePage : DWORD -> "dword"
# TestChar : BYTE -> "byte"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。