ホーム › System.LibraryLoader › EnumResourceLanguagesW
EnumResourceLanguagesW
関数リソースの言語をUnicode名で列挙する。
シグネチャ
// KERNEL32.dll (Unicode / -W)
#include <windows.h>
BOOL EnumResourceLanguagesW(
HMODULE hModule, // optional
LPCWSTR lpType,
LPCWSTR lpName,
ENUMRESLANGPROCW lpEnumFunc,
INT_PTR lParam
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hModule | HMODULE | inoptional |
| lpType | LPCWSTR | in |
| lpName | LPCWSTR | in |
| lpEnumFunc | ENUMRESLANGPROCW | in |
| lParam | INT_PTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll (Unicode / -W)
#include <windows.h>
BOOL EnumResourceLanguagesW(
HMODULE hModule, // optional
LPCWSTR lpType,
LPCWSTR lpName,
ENUMRESLANGPROCW lpEnumFunc,
INT_PTR lParam
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool EnumResourceLanguagesW(
IntPtr hModule, // HMODULE optional
[MarshalAs(UnmanagedType.LPWStr)] string lpType, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string lpName, // LPCWSTR
IntPtr lpEnumFunc, // ENUMRESLANGPROCW
IntPtr lParam // INT_PTR
);<DllImport("KERNEL32.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function EnumResourceLanguagesW(
hModule As IntPtr, ' HMODULE optional
<MarshalAs(UnmanagedType.LPWStr)> lpType As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> lpName As String, ' LPCWSTR
lpEnumFunc As IntPtr, ' ENUMRESLANGPROCW
lParam As IntPtr ' INT_PTR
) As Boolean
End Function' hModule : HMODULE optional
' lpType : LPCWSTR
' lpName : LPCWSTR
' lpEnumFunc : ENUMRESLANGPROCW
' lParam : INT_PTR
Declare PtrSafe Function EnumResourceLanguagesW Lib "kernel32" ( _
ByVal hModule As LongPtr, _
ByVal lpType As LongPtr, _
ByVal lpName As LongPtr, _
ByVal lpEnumFunc As LongPtr, _
ByVal lParam 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
EnumResourceLanguagesW = ctypes.windll.kernel32.EnumResourceLanguagesW
EnumResourceLanguagesW.restype = wintypes.BOOL
EnumResourceLanguagesW.argtypes = [
wintypes.HANDLE, # hModule : HMODULE optional
wintypes.LPCWSTR, # lpType : LPCWSTR
wintypes.LPCWSTR, # lpName : LPCWSTR
ctypes.c_void_p, # lpEnumFunc : ENUMRESLANGPROCW
ctypes.c_ssize_t, # lParam : INT_PTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
EnumResourceLanguagesW = Fiddle::Function.new(
lib['EnumResourceLanguagesW'],
[
Fiddle::TYPE_VOIDP, # hModule : HMODULE optional
Fiddle::TYPE_VOIDP, # lpType : LPCWSTR
Fiddle::TYPE_VOIDP, # lpName : LPCWSTR
Fiddle::TYPE_VOIDP, # lpEnumFunc : ENUMRESLANGPROCW
Fiddle::TYPE_INTPTR_T, # lParam : INT_PTR
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "kernel32")]
extern "system" {
fn EnumResourceLanguagesW(
hModule: *mut core::ffi::c_void, // HMODULE optional
lpType: *const u16, // LPCWSTR
lpName: *const u16, // LPCWSTR
lpEnumFunc: *const core::ffi::c_void, // ENUMRESLANGPROCW
lParam: isize // INT_PTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool EnumResourceLanguagesW(IntPtr hModule, [MarshalAs(UnmanagedType.LPWStr)] string lpType, [MarshalAs(UnmanagedType.LPWStr)] string lpName, IntPtr lpEnumFunc, IntPtr lParam);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_EnumResourceLanguagesW' -Namespace Win32 -PassThru
# $api::EnumResourceLanguagesW(hModule, lpType, lpName, lpEnumFunc, lParam)#uselib "KERNEL32.dll"
#func global EnumResourceLanguagesW "EnumResourceLanguagesW" wptr, wptr, wptr, wptr, wptr
; EnumResourceLanguagesW hModule, lpType, lpName, lpEnumFunc, lParam ; 戻り値は stat
; hModule : HMODULE optional -> "wptr"
; lpType : LPCWSTR -> "wptr"
; lpName : LPCWSTR -> "wptr"
; lpEnumFunc : ENUMRESLANGPROCW -> "wptr"
; lParam : INT_PTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global EnumResourceLanguagesW "EnumResourceLanguagesW" sptr, wstr, wstr, sptr, sptr
; res = EnumResourceLanguagesW(hModule, lpType, lpName, lpEnumFunc, lParam)
; hModule : HMODULE optional -> "sptr"
; lpType : LPCWSTR -> "wstr"
; lpName : LPCWSTR -> "wstr"
; lpEnumFunc : ENUMRESLANGPROCW -> "sptr"
; lParam : INT_PTR -> "sptr"; BOOL EnumResourceLanguagesW(HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, ENUMRESLANGPROCW lpEnumFunc, INT_PTR lParam)
#uselib "KERNEL32.dll"
#cfunc global EnumResourceLanguagesW "EnumResourceLanguagesW" intptr, wstr, wstr, intptr, intptr
; res = EnumResourceLanguagesW(hModule, lpType, lpName, lpEnumFunc, lParam)
; hModule : HMODULE optional -> "intptr"
; lpType : LPCWSTR -> "wstr"
; lpName : LPCWSTR -> "wstr"
; lpEnumFunc : ENUMRESLANGPROCW -> "intptr"
; lParam : INT_PTR -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procEnumResourceLanguagesW = kernel32.NewProc("EnumResourceLanguagesW")
)
// hModule (HMODULE optional), lpType (LPCWSTR), lpName (LPCWSTR), lpEnumFunc (ENUMRESLANGPROCW), lParam (INT_PTR)
r1, _, err := procEnumResourceLanguagesW.Call(
uintptr(hModule),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpType))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpName))),
uintptr(lpEnumFunc),
uintptr(lParam),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction EnumResourceLanguagesW(
hModule: THandle; // HMODULE optional
lpType: PWideChar; // LPCWSTR
lpName: PWideChar; // LPCWSTR
lpEnumFunc: Pointer; // ENUMRESLANGPROCW
lParam: NativeInt // INT_PTR
): BOOL; stdcall;
external 'KERNEL32.dll' name 'EnumResourceLanguagesW';result := DllCall("KERNEL32\EnumResourceLanguagesW"
, "Ptr", hModule ; HMODULE optional
, "WStr", lpType ; LPCWSTR
, "WStr", lpName ; LPCWSTR
, "Ptr", lpEnumFunc ; ENUMRESLANGPROCW
, "Ptr", lParam ; INT_PTR
, "Int") ; return: BOOL●EnumResourceLanguagesW(hModule, lpType, lpName, lpEnumFunc, lParam) = DLL("KERNEL32.dll", "bool EnumResourceLanguagesW(void*, char*, char*, void*, int)")
# 呼び出し: EnumResourceLanguagesW(hModule, lpType, lpName, lpEnumFunc, lParam)
# hModule : HMODULE optional -> "void*"
# lpType : LPCWSTR -> "char*"
# lpName : LPCWSTR -> "char*"
# lpEnumFunc : ENUMRESLANGPROCW -> "void*"
# lParam : INT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。