ホーム › Globalization › SetUserGeoName
SetUserGeoName
関数ユーザーの地理的位置名を設定する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL SetUserGeoName(
LPWSTR geoName
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| geoName | LPWSTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL SetUserGeoName(
LPWSTR geoName
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool SetUserGeoName(
[MarshalAs(UnmanagedType.LPWStr)] string geoName // LPWSTR
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetUserGeoName(
<MarshalAs(UnmanagedType.LPWStr)> geoName As String ' LPWSTR
) As Boolean
End Function' geoName : LPWSTR
Declare PtrSafe Function SetUserGeoName Lib "kernel32" ( _
ByVal geoName As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetUserGeoName = ctypes.windll.kernel32.SetUserGeoName
SetUserGeoName.restype = wintypes.BOOL
SetUserGeoName.argtypes = [
wintypes.LPCWSTR, # geoName : LPWSTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
SetUserGeoName = Fiddle::Function.new(
lib['SetUserGeoName'],
[
Fiddle::TYPE_VOIDP, # geoName : LPWSTR
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn SetUserGeoName(
geoName: *mut u16 // LPWSTR
) -> 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 SetUserGeoName([MarshalAs(UnmanagedType.LPWStr)] string geoName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_SetUserGeoName' -Namespace Win32 -PassThru
# $api::SetUserGeoName(geoName)#uselib "KERNEL32.dll"
#func global SetUserGeoName "SetUserGeoName" sptr
; SetUserGeoName geoName ; 戻り値は stat
; geoName : LPWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global SetUserGeoName "SetUserGeoName" wstr
; res = SetUserGeoName(geoName)
; geoName : LPWSTR -> "wstr"; BOOL SetUserGeoName(LPWSTR geoName)
#uselib "KERNEL32.dll"
#cfunc global SetUserGeoName "SetUserGeoName" wstr
; res = SetUserGeoName(geoName)
; geoName : LPWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procSetUserGeoName = kernel32.NewProc("SetUserGeoName")
)
// geoName (LPWSTR)
r1, _, err := procSetUserGeoName.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(geoName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetUserGeoName(
geoName: PWideChar // LPWSTR
): BOOL; stdcall;
external 'KERNEL32.dll' name 'SetUserGeoName';result := DllCall("KERNEL32\SetUserGeoName"
, "WStr", geoName ; LPWSTR
, "Int") ; return: BOOL●SetUserGeoName(geoName) = DLL("KERNEL32.dll", "bool SetUserGeoName(char*)")
# 呼び出し: SetUserGeoName(geoName)
# geoName : LPWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。