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