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

GetUserGeoID

関数
ユーザーの地理的位置識別子を取得する。
DLLKERNEL32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

INT GetUserGeoID(
    SYSGEOCLASS GeoClass
);

パラメーター

名前方向
GeoClassSYSGEOCLASSin

戻り値の型: INT

各言語での呼び出し定義

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

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

GetUserGeoID = ctypes.windll.kernel32.GetUserGeoID
GetUserGeoID.restype = ctypes.c_int
GetUserGeoID.argtypes = [
    ctypes.c_int,  # GeoClass : SYSGEOCLASS
]
require 'fiddle'
require 'fiddle/import'

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

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procGetUserGeoID = kernel32.NewProc("GetUserGeoID")
)

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