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