ホーム › UI.WindowsAndMessaging › CreateIcon
CreateIcon
関数ANDマスクとXORマスクのビットからアイコンを作成する。
シグネチャ
// USER32.dll
#include <windows.h>
HICON CreateIcon(
HINSTANCE hInstance, // optional
INT nWidth,
INT nHeight,
BYTE cPlanes,
BYTE cBitsPixel,
const BYTE* lpbANDbits,
const BYTE* lpbXORbits
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hInstance | HINSTANCE | inoptional | アイコンを作成するモジュールのインスタンスへのハンドルです。 |
| nWidth | INT | in | アイコンの幅(ピクセル単位)です。注釈を参照してください。 |
| nHeight | INT | in | アイコンの高さ(ピクセル単位)です。注釈を参照してください。 |
| cPlanes | BYTE | in | アイコンの XOR ビットマスクにおけるプレーン数です。注釈を参照してください。 |
| cBitsPixel | BYTE | in | アイコンの XOR ビットマスクにおける 1 ピクセルあたりのビット数です。 |
| lpbANDbits | BYTE* | in | アイコンの AND ビットマスクのビット値を格納するバイト配列です。このビットマスクはモノクロビットマップを表します。注釈を参照してください。 |
| lpbXORbits | BYTE* | in | アイコンの XOR ビットマスクのビット値を格納するバイト配列です。このビットマスクはモノクロまたはカラーのビットマップを表します。注釈を参照してください。 |
戻り値の型: HICON
公式ドキュメント
指定したサイズ、色、およびビットパターンを持つアイコンを作成します。
戻り値
解説(Remarks)
アイコンの公称サイズを確認するには、GetSystemMetrics 関数に SM_CXICON または SM_CYICON 値を指定して使用します。また、この API の DPI 対応版である (GetSystemMetricsForDpi)(/windows/win32/api/winuser/nf-winuser-getsystemmetricsfordpi) を使用することもできます。詳細については、アイコンのサイズ および Windows における高 DPI デスクトップアプリケーション開発 を参照してください。
lpbANDbits および lpbXORbits パラメーターの詳細については、CreateBitmap 関数の lpBits パラメーターの説明を参照してください。
モノクロアイコンの場合、CreateIcon は AND ビットマスクと XOR ビットマスクに対して次の真理値表を適用します。
| AND bitmask | XOR bitmask | 表示 |
|---|---|---|
| 0 | 0 | 黒 |
| 0 | 1 | 白 |
| 1 | 0 | 画面 |
| 1 | 1 | 画面の反転 |
アイコンの使用を終えたら、DestroyIcon 関数を使用して破棄してください。
例
例については、アイコンの作成 を参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
HICON CreateIcon(
HINSTANCE hInstance, // optional
INT nWidth,
INT nHeight,
BYTE cPlanes,
BYTE cBitsPixel,
const BYTE* lpbANDbits,
const BYTE* lpbXORbits
);[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern IntPtr CreateIcon(
IntPtr hInstance, // HINSTANCE optional
int nWidth, // INT
int nHeight, // INT
byte cPlanes, // BYTE
byte cBitsPixel, // BYTE
IntPtr lpbANDbits, // BYTE*
IntPtr lpbXORbits // BYTE*
);<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CreateIcon(
hInstance As IntPtr, ' HINSTANCE optional
nWidth As Integer, ' INT
nHeight As Integer, ' INT
cPlanes As Byte, ' BYTE
cBitsPixel As Byte, ' BYTE
lpbANDbits As IntPtr, ' BYTE*
lpbXORbits As IntPtr ' BYTE*
) As IntPtr
End Function' hInstance : HINSTANCE optional
' nWidth : INT
' nHeight : INT
' cPlanes : BYTE
' cBitsPixel : BYTE
' lpbANDbits : BYTE*
' lpbXORbits : BYTE*
Declare PtrSafe Function CreateIcon Lib "user32" ( _
ByVal hInstance As LongPtr, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal cPlanes As Byte, _
ByVal cBitsPixel As Byte, _
ByVal lpbANDbits As LongPtr, _
ByVal lpbXORbits As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateIcon = ctypes.windll.user32.CreateIcon
CreateIcon.restype = ctypes.c_void_p
CreateIcon.argtypes = [
wintypes.HANDLE, # hInstance : HINSTANCE optional
ctypes.c_int, # nWidth : INT
ctypes.c_int, # nHeight : INT
ctypes.c_ubyte, # cPlanes : BYTE
ctypes.c_ubyte, # cBitsPixel : BYTE
ctypes.POINTER(ctypes.c_ubyte), # lpbANDbits : BYTE*
ctypes.POINTER(ctypes.c_ubyte), # lpbXORbits : BYTE*
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
CreateIcon = Fiddle::Function.new(
lib['CreateIcon'],
[
Fiddle::TYPE_VOIDP, # hInstance : HINSTANCE optional
Fiddle::TYPE_INT, # nWidth : INT
Fiddle::TYPE_INT, # nHeight : INT
-Fiddle::TYPE_CHAR, # cPlanes : BYTE
-Fiddle::TYPE_CHAR, # cBitsPixel : BYTE
Fiddle::TYPE_VOIDP, # lpbANDbits : BYTE*
Fiddle::TYPE_VOIDP, # lpbXORbits : BYTE*
],
Fiddle::TYPE_VOIDP)#[link(name = "user32")]
extern "system" {
fn CreateIcon(
hInstance: *mut core::ffi::c_void, // HINSTANCE optional
nWidth: i32, // INT
nHeight: i32, // INT
cPlanes: u8, // BYTE
cBitsPixel: u8, // BYTE
lpbANDbits: *const u8, // BYTE*
lpbXORbits: *const u8 // BYTE*
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USER32.dll", SetLastError = true)]
public static extern IntPtr CreateIcon(IntPtr hInstance, int nWidth, int nHeight, byte cPlanes, byte cBitsPixel, IntPtr lpbANDbits, IntPtr lpbXORbits);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_CreateIcon' -Namespace Win32 -PassThru
# $api::CreateIcon(hInstance, nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits)#uselib "USER32.dll"
#func global CreateIcon "CreateIcon" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; CreateIcon hInstance, nWidth, nHeight, cPlanes, cBitsPixel, varptr(lpbANDbits), varptr(lpbXORbits) ; 戻り値は stat
; hInstance : HINSTANCE optional -> "sptr"
; nWidth : INT -> "sptr"
; nHeight : INT -> "sptr"
; cPlanes : BYTE -> "sptr"
; cBitsPixel : BYTE -> "sptr"
; lpbANDbits : BYTE* -> "sptr"
; lpbXORbits : BYTE* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USER32.dll" #cfunc global CreateIcon "CreateIcon" sptr, int, int, int, int, var, var ; res = CreateIcon(hInstance, nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits) ; hInstance : HINSTANCE optional -> "sptr" ; nWidth : INT -> "int" ; nHeight : INT -> "int" ; cPlanes : BYTE -> "int" ; cBitsPixel : BYTE -> "int" ; lpbANDbits : BYTE* -> "var" ; lpbXORbits : BYTE* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USER32.dll" #cfunc global CreateIcon "CreateIcon" sptr, int, int, int, int, sptr, sptr ; res = CreateIcon(hInstance, nWidth, nHeight, cPlanes, cBitsPixel, varptr(lpbANDbits), varptr(lpbXORbits)) ; hInstance : HINSTANCE optional -> "sptr" ; nWidth : INT -> "int" ; nHeight : INT -> "int" ; cPlanes : BYTE -> "int" ; cBitsPixel : BYTE -> "int" ; lpbANDbits : BYTE* -> "sptr" ; lpbXORbits : BYTE* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HICON CreateIcon(HINSTANCE hInstance, INT nWidth, INT nHeight, BYTE cPlanes, BYTE cBitsPixel, BYTE* lpbANDbits, BYTE* lpbXORbits) #uselib "USER32.dll" #cfunc global CreateIcon "CreateIcon" intptr, int, int, int, int, var, var ; res = CreateIcon(hInstance, nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits) ; hInstance : HINSTANCE optional -> "intptr" ; nWidth : INT -> "int" ; nHeight : INT -> "int" ; cPlanes : BYTE -> "int" ; cBitsPixel : BYTE -> "int" ; lpbANDbits : BYTE* -> "var" ; lpbXORbits : BYTE* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HICON CreateIcon(HINSTANCE hInstance, INT nWidth, INT nHeight, BYTE cPlanes, BYTE cBitsPixel, BYTE* lpbANDbits, BYTE* lpbXORbits) #uselib "USER32.dll" #cfunc global CreateIcon "CreateIcon" intptr, int, int, int, int, intptr, intptr ; res = CreateIcon(hInstance, nWidth, nHeight, cPlanes, cBitsPixel, varptr(lpbANDbits), varptr(lpbXORbits)) ; hInstance : HINSTANCE optional -> "intptr" ; nWidth : INT -> "int" ; nHeight : INT -> "int" ; cPlanes : BYTE -> "int" ; cBitsPixel : BYTE -> "int" ; lpbANDbits : BYTE* -> "intptr" ; lpbXORbits : BYTE* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procCreateIcon = user32.NewProc("CreateIcon")
)
// hInstance (HINSTANCE optional), nWidth (INT), nHeight (INT), cPlanes (BYTE), cBitsPixel (BYTE), lpbANDbits (BYTE*), lpbXORbits (BYTE*)
r1, _, err := procCreateIcon.Call(
uintptr(hInstance),
uintptr(nWidth),
uintptr(nHeight),
uintptr(cPlanes),
uintptr(cBitsPixel),
uintptr(lpbANDbits),
uintptr(lpbXORbits),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HICONfunction CreateIcon(
hInstance: THandle; // HINSTANCE optional
nWidth: Integer; // INT
nHeight: Integer; // INT
cPlanes: Byte; // BYTE
cBitsPixel: Byte; // BYTE
lpbANDbits: Pointer; // BYTE*
lpbXORbits: Pointer // BYTE*
): THandle; stdcall;
external 'USER32.dll' name 'CreateIcon';result := DllCall("USER32\CreateIcon"
, "Ptr", hInstance ; HINSTANCE optional
, "Int", nWidth ; INT
, "Int", nHeight ; INT
, "UChar", cPlanes ; BYTE
, "UChar", cBitsPixel ; BYTE
, "Ptr", lpbANDbits ; BYTE*
, "Ptr", lpbXORbits ; BYTE*
, "Ptr") ; return: HICON●CreateIcon(hInstance, nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits) = DLL("USER32.dll", "void* CreateIcon(void*, int, int, byte, byte, void*, void*)")
# 呼び出し: CreateIcon(hInstance, nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits)
# hInstance : HINSTANCE optional -> "void*"
# nWidth : INT -> "int"
# nHeight : INT -> "int"
# cPlanes : BYTE -> "byte"
# cBitsPixel : BYTE -> "byte"
# lpbANDbits : BYTE* -> "void*"
# lpbXORbits : BYTE* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "user32" fn CreateIcon(
hInstance: ?*anyopaque, // HINSTANCE optional
nWidth: i32, // INT
nHeight: i32, // INT
cPlanes: u8, // BYTE
cBitsPixel: u8, // BYTE
lpbANDbits: [*c]u8, // BYTE*
lpbXORbits: [*c]u8 // BYTE*
) callconv(std.os.windows.WINAPI) ?*anyopaque;proc CreateIcon(
hInstance: pointer, # HINSTANCE optional
nWidth: int32, # INT
nHeight: int32, # INT
cPlanes: uint8, # BYTE
cBitsPixel: uint8, # BYTE
lpbANDbits: ptr uint8, # BYTE*
lpbXORbits: ptr uint8 # BYTE*
): pointer {.importc: "CreateIcon", stdcall, dynlib: "USER32.dll".}pragma(lib, "user32");
extern(Windows)
void* CreateIcon(
void* hInstance, // HINSTANCE optional
int nWidth, // INT
int nHeight, // INT
ubyte cPlanes, // BYTE
ubyte cBitsPixel, // BYTE
ubyte* lpbANDbits, // BYTE*
ubyte* lpbXORbits // BYTE*
);ccall((:CreateIcon, "USER32.dll"), stdcall, Ptr{Cvoid},
(Ptr{Cvoid}, Int32, Int32, UInt8, UInt8, Ptr{UInt8}, Ptr{UInt8}),
hInstance, nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits)
# hInstance : HINSTANCE optional -> Ptr{Cvoid}
# nWidth : INT -> Int32
# nHeight : INT -> Int32
# cPlanes : BYTE -> UInt8
# cBitsPixel : BYTE -> UInt8
# lpbANDbits : BYTE* -> Ptr{UInt8}
# lpbXORbits : BYTE* -> Ptr{UInt8}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void* CreateIcon(
void* hInstance,
int32_t nWidth,
int32_t nHeight,
uint8_t cPlanes,
uint8_t cBitsPixel,
uint8_t* lpbANDbits,
uint8_t* lpbXORbits);
]]
local user32 = ffi.load("user32")
-- user32.CreateIcon(hInstance, nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits)
-- hInstance : HINSTANCE optional
-- nWidth : INT
-- nHeight : INT
-- cPlanes : BYTE
-- cBitsPixel : BYTE
-- lpbANDbits : BYTE*
-- lpbXORbits : BYTE*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('USER32.dll');
const CreateIcon = lib.func('__stdcall', 'CreateIcon', 'void *', ['void *', 'int32_t', 'int32_t', 'uint8_t', 'uint8_t', 'uint8_t *', 'uint8_t *']);
// CreateIcon(hInstance, nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits)
// hInstance : HINSTANCE optional -> 'void *'
// nWidth : INT -> 'int32_t'
// nHeight : INT -> 'int32_t'
// cPlanes : BYTE -> 'uint8_t'
// cBitsPixel : BYTE -> 'uint8_t'
// lpbANDbits : BYTE* -> 'uint8_t *'
// lpbXORbits : BYTE* -> 'uint8_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("USER32.dll", {
CreateIcon: { parameters: ["pointer", "i32", "i32", "u8", "u8", "pointer", "pointer"], result: "pointer" },
});
// lib.symbols.CreateIcon(hInstance, nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits)
// hInstance : HINSTANCE optional -> "pointer"
// nWidth : INT -> "i32"
// nHeight : INT -> "i32"
// cPlanes : BYTE -> "u8"
// cBitsPixel : BYTE -> "u8"
// lpbANDbits : BYTE* -> "pointer"
// lpbXORbits : BYTE* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void* CreateIcon(
void* hInstance,
int32_t nWidth,
int32_t nHeight,
uint8_t cPlanes,
uint8_t cBitsPixel,
uint8_t* lpbANDbits,
uint8_t* lpbXORbits);
C, "USER32.dll");
// $ffi->CreateIcon(hInstance, nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits);
// hInstance : HINSTANCE optional
// nWidth : INT
// nHeight : INT
// cPlanes : BYTE
// cBitsPixel : BYTE
// lpbANDbits : BYTE*
// lpbXORbits : BYTE*
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface User32 extends StdCallLibrary {
User32 INSTANCE = Native.load("user32", User32.class);
Pointer CreateIcon(
Pointer hInstance, // HINSTANCE optional
int nWidth, // INT
int nHeight, // INT
byte cPlanes, // BYTE
byte cBitsPixel, // BYTE
byte[] lpbANDbits, // BYTE*
byte[] lpbXORbits // BYTE*
);
}@[Link("user32")]
lib LibUSER32
fun CreateIcon = CreateIcon(
hInstance : Void*, # HINSTANCE optional
nWidth : Int32, # INT
nHeight : Int32, # INT
cPlanes : UInt8, # BYTE
cBitsPixel : UInt8, # BYTE
lpbANDbits : UInt8*, # BYTE*
lpbXORbits : UInt8* # BYTE*
) : Void*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CreateIconNative = Pointer<Void> Function(Pointer<Void>, Int32, Int32, Uint8, Uint8, Pointer<Uint8>, Pointer<Uint8>);
typedef CreateIconDart = Pointer<Void> Function(Pointer<Void>, int, int, int, int, Pointer<Uint8>, Pointer<Uint8>);
final CreateIcon = DynamicLibrary.open('USER32.dll')
.lookupFunction<CreateIconNative, CreateIconDart>('CreateIcon');
// hInstance : HINSTANCE optional -> Pointer<Void>
// nWidth : INT -> Int32
// nHeight : INT -> Int32
// cPlanes : BYTE -> Uint8
// cBitsPixel : BYTE -> Uint8
// lpbANDbits : BYTE* -> Pointer<Uint8>
// lpbXORbits : BYTE* -> Pointer<Uint8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CreateIcon(
hInstance: THandle; // HINSTANCE optional
nWidth: Integer; // INT
nHeight: Integer; // INT
cPlanes: Byte; // BYTE
cBitsPixel: Byte; // BYTE
lpbANDbits: Pointer; // BYTE*
lpbXORbits: Pointer // BYTE*
): THandle; stdcall;
external 'USER32.dll' name 'CreateIcon';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CreateIcon"
c_CreateIcon :: Ptr () -> Int32 -> Int32 -> Word8 -> Word8 -> Ptr Word8 -> Ptr Word8 -> IO (Ptr ())
-- hInstance : HINSTANCE optional -> Ptr ()
-- nWidth : INT -> Int32
-- nHeight : INT -> Int32
-- cPlanes : BYTE -> Word8
-- cBitsPixel : BYTE -> Word8
-- lpbANDbits : BYTE* -> Ptr Word8
-- lpbXORbits : BYTE* -> Ptr Word8
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let createicon =
foreign "CreateIcon"
((ptr void) @-> int32_t @-> int32_t @-> uint8_t @-> uint8_t @-> (ptr uint8_t) @-> (ptr uint8_t) @-> returning (ptr void))
(* hInstance : HINSTANCE optional -> (ptr void) *)
(* nWidth : INT -> int32_t *)
(* nHeight : INT -> int32_t *)
(* cPlanes : BYTE -> uint8_t *)
(* cBitsPixel : BYTE -> uint8_t *)
(* lpbANDbits : BYTE* -> (ptr uint8_t) *)
(* lpbXORbits : BYTE* -> (ptr uint8_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library user32 (t "USER32.dll"))
(cffi:use-foreign-library user32)
(cffi:defcfun ("CreateIcon" create-icon :convention :stdcall) :pointer
(h-instance :pointer) ; HINSTANCE optional
(n-width :int32) ; INT
(n-height :int32) ; INT
(c-planes :uint8) ; BYTE
(c-bits-pixel :uint8) ; BYTE
(lpb-andbits :pointer) ; BYTE*
(lpb-xorbits :pointer)) ; BYTE*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CreateIcon = Win32::API::More->new('USER32',
'HANDLE CreateIcon(HANDLE hInstance, int nWidth, int nHeight, BYTE cPlanes, BYTE cBitsPixel, LPVOID lpbANDbits, LPVOID lpbXORbits)');
# my $ret = $CreateIcon->Call($hInstance, $nWidth, $nHeight, $cPlanes, $cBitsPixel, $lpbANDbits, $lpbXORbits);
# hInstance : HINSTANCE optional -> HANDLE
# nWidth : INT -> int
# nHeight : INT -> int
# cPlanes : BYTE -> BYTE
# cBitsPixel : BYTE -> BYTE
# lpbANDbits : BYTE* -> LPVOID
# lpbXORbits : BYTE* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。