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

SetUserGeoID

関数
ユーザーの地理的位置識別子を設定する。
DLLKERNEL32.dll呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

BOOL SetUserGeoID(
    INT GeoId
);

パラメーター

名前方向
GeoIdINTin

戻り値の型: BOOL

各言語での呼び出し定義

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

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

SetUserGeoID = ctypes.windll.kernel32.SetUserGeoID
SetUserGeoID.restype = wintypes.BOOL
SetUserGeoID.argtypes = [
    ctypes.c_int,  # GeoId : INT
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procSetUserGeoID = kernel32.NewProc("SetUserGeoID")
)

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