Win32 API 日本語リファレンス
ホームUI.Shell › PathGetCharTypeA

PathGetCharTypeA

関数
パス中の1文字が持つ意味の種類を示すフラグを取得する。
DLLSHLWAPI.dll文字セットANSI (-A)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// SHLWAPI.dll  (ANSI / -A)
#include <windows.h>

DWORD PathGetCharTypeA(
    BYTE ch
);

パラメーター

名前方向
chBYTEin

戻り値の型: DWORD

各言語での呼び出し定義

// SHLWAPI.dll  (ANSI / -A)
#include <windows.h>

DWORD PathGetCharTypeA(
    BYTE ch
);
[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint PathGetCharTypeA(
    byte ch   // BYTE
);
<DllImport("SHLWAPI.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function PathGetCharTypeA(
    ch As Byte   ' BYTE
) As UInteger
End Function
' ch : BYTE
Declare PtrSafe Function PathGetCharTypeA Lib "shlwapi" ( _
    ByVal ch As Byte) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PathGetCharTypeA = ctypes.windll.shlwapi.PathGetCharTypeA
PathGetCharTypeA.restype = wintypes.DWORD
PathGetCharTypeA.argtypes = [
    ctypes.c_ubyte,  # ch : BYTE
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHLWAPI.dll')
PathGetCharTypeA = Fiddle::Function.new(
  lib['PathGetCharTypeA'],
  [
    -Fiddle::TYPE_CHAR,  # ch : BYTE
  ],
  -Fiddle::TYPE_INT)
#[link(name = "shlwapi")]
extern "system" {
    fn PathGetCharTypeA(
        ch: u8  // BYTE
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi)]
public static extern uint PathGetCharTypeA(byte ch);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_PathGetCharTypeA' -Namespace Win32 -PassThru
# $api::PathGetCharTypeA(ch)
#uselib "SHLWAPI.dll"
#func global PathGetCharTypeA "PathGetCharTypeA" sptr
; PathGetCharTypeA ch   ; 戻り値は stat
; ch : BYTE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SHLWAPI.dll"
#cfunc global PathGetCharTypeA "PathGetCharTypeA" int
; res = PathGetCharTypeA(ch)
; ch : BYTE -> "int"
; DWORD PathGetCharTypeA(BYTE ch)
#uselib "SHLWAPI.dll"
#cfunc global PathGetCharTypeA "PathGetCharTypeA" int
; res = PathGetCharTypeA(ch)
; ch : BYTE -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
	procPathGetCharTypeA = shlwapi.NewProc("PathGetCharTypeA")
)

// ch (BYTE)
r1, _, err := procPathGetCharTypeA.Call(
	uintptr(ch),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function PathGetCharTypeA(
  ch: Byte   // BYTE
): DWORD; stdcall;
  external 'SHLWAPI.dll' name 'PathGetCharTypeA';
result := DllCall("SHLWAPI\PathGetCharTypeA"
    , "UChar", ch   ; BYTE
    , "UInt")   ; return: DWORD
●PathGetCharTypeA(ch) = DLL("SHLWAPI.dll", "dword PathGetCharTypeA(byte)")
# 呼び出し: PathGetCharTypeA(ch)
# ch : BYTE -> "byte"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。