Win32 API 日本語リファレンス
ホームGlobalization › GetSystemDefaultLangID

GetSystemDefaultLangID

関数
システム既定の言語識別子を取得する。
DLLKERNEL32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// KERNEL32.dll
#include <windows.h>

WORD GetSystemDefaultLangID(void);

パラメーターなし。戻り値: WORD

各言語での呼び出し定義

// KERNEL32.dll
#include <windows.h>

WORD GetSystemDefaultLangID(void);
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern ushort GetSystemDefaultLangID();
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function GetSystemDefaultLangID() As UShort
End Function
Declare PtrSafe Function GetSystemDefaultLangID Lib "kernel32" () As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetSystemDefaultLangID = ctypes.windll.kernel32.GetSystemDefaultLangID
GetSystemDefaultLangID.restype = ctypes.c_ushort
GetSystemDefaultLangID.argtypes = []
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
GetSystemDefaultLangID = Fiddle::Function.new(
  lib['GetSystemDefaultLangID'],
  [],
  -Fiddle::TYPE_SHORT)
#[link(name = "kernel32")]
extern "system" {
    fn GetSystemDefaultLangID() -> u16;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("KERNEL32.dll")]
public static extern ushort GetSystemDefaultLangID();
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_GetSystemDefaultLangID' -Namespace Win32 -PassThru
# $api::GetSystemDefaultLangID()
#uselib "KERNEL32.dll"
#func global GetSystemDefaultLangID "GetSystemDefaultLangID"
; GetSystemDefaultLangID   ; 戻り値は stat
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global GetSystemDefaultLangID "GetSystemDefaultLangID"
; res = GetSystemDefaultLangID()
; WORD GetSystemDefaultLangID()
#uselib "KERNEL32.dll"
#cfunc global GetSystemDefaultLangID "GetSystemDefaultLangID"
; res = GetSystemDefaultLangID()
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procGetSystemDefaultLangID = kernel32.NewProc("GetSystemDefaultLangID")
)

r1, _, err := procGetSystemDefaultLangID.Call()
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // WORD
function GetSystemDefaultLangID: Word; stdcall;
  external 'KERNEL32.dll' name 'GetSystemDefaultLangID';
result := DllCall("KERNEL32\GetSystemDefaultLangID", "UShort")
●GetSystemDefaultLangID() = DLL("KERNEL32.dll", "int GetSystemDefaultLangID()")
# 呼び出し: GetSystemDefaultLangID()
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。