Win32 API 日本語リファレンス
ホームGraphics.OpenGL › gluProject

gluProject

関数
オブジェクト座標をウィンドウ座標へ投影変換する。
DLLGLU32.dll呼出規約winapi

シグネチャ

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

INT gluProject(
    DOUBLE objx,
    DOUBLE objy,
    DOUBLE objz,
    const DOUBLE* modelMatrix,
    const DOUBLE* projMatrix,
    const INT* viewport,
    DOUBLE* winx,
    DOUBLE* winy,
    DOUBLE* winz
);

パラメーター

名前方向説明
objxDOUBLEin投影するオブジェクト座標のx成分。
objyDOUBLEin投影するオブジェクト座標のy成分。
objzDOUBLEin投影するオブジェクト座標のz成分。
modelMatrixDOUBLE*in現在のモデルビュー行列(列優先16要素)へのポインタ。
projMatrixDOUBLE*in現在の射影行列(列優先16要素)へのポインタ。
viewportINT*in現在のビューポート(x,y,w,h)を格納したINT配列。
winxDOUBLE*inout算出されたウィンドウ座標xを受け取る出力先ポインタ。
winyDOUBLE*inout算出されたウィンドウ座標yを受け取る出力先ポインタ。
winzDOUBLE*inout算出された深度値(ウィンドウ座標z)を受け取る出力先ポインタ。

戻り値の型: INT

各言語での呼び出し定義

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

INT gluProject(
    DOUBLE objx,
    DOUBLE objy,
    DOUBLE objz,
    const DOUBLE* modelMatrix,
    const DOUBLE* projMatrix,
    const INT* viewport,
    DOUBLE* winx,
    DOUBLE* winy,
    DOUBLE* winz
);
[DllImport("GLU32.dll", ExactSpelling = true)]
static extern int gluProject(
    double objx,   // DOUBLE
    double objy,   // DOUBLE
    double objz,   // DOUBLE
    ref double modelMatrix,   // DOUBLE*
    ref double projMatrix,   // DOUBLE*
    ref int viewport,   // INT*
    ref double winx,   // DOUBLE* in/out
    ref double winy,   // DOUBLE* in/out
    ref double winz   // DOUBLE* in/out
);
<DllImport("GLU32.dll", ExactSpelling:=True)>
Public Shared Function gluProject(
    objx As Double,   ' DOUBLE
    objy As Double,   ' DOUBLE
    objz As Double,   ' DOUBLE
    ByRef modelMatrix As Double,   ' DOUBLE*
    ByRef projMatrix As Double,   ' DOUBLE*
    ByRef viewport As Integer,   ' INT*
    ByRef winx As Double,   ' DOUBLE* in/out
    ByRef winy As Double,   ' DOUBLE* in/out
    ByRef winz As Double   ' DOUBLE* in/out
) As Integer
End Function
' objx : DOUBLE
' objy : DOUBLE
' objz : DOUBLE
' modelMatrix : DOUBLE*
' projMatrix : DOUBLE*
' viewport : INT*
' winx : DOUBLE* in/out
' winy : DOUBLE* in/out
' winz : DOUBLE* in/out
Declare PtrSafe Function gluProject Lib "glu32" ( _
    ByVal objx As Double, _
    ByVal objy As Double, _
    ByVal objz As Double, _
    ByRef modelMatrix As Double, _
    ByRef projMatrix As Double, _
    ByRef viewport As Long, _
    ByRef winx As Double, _
    ByRef winy As Double, _
    ByRef winz As Double) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

gluProject = ctypes.windll.glu32.gluProject
gluProject.restype = ctypes.c_int
gluProject.argtypes = [
    ctypes.c_double,  # objx : DOUBLE
    ctypes.c_double,  # objy : DOUBLE
    ctypes.c_double,  # objz : DOUBLE
    ctypes.POINTER(ctypes.c_double),  # modelMatrix : DOUBLE*
    ctypes.POINTER(ctypes.c_double),  # projMatrix : DOUBLE*
    ctypes.POINTER(ctypes.c_int),  # viewport : INT*
    ctypes.POINTER(ctypes.c_double),  # winx : DOUBLE* in/out
    ctypes.POINTER(ctypes.c_double),  # winy : DOUBLE* in/out
    ctypes.POINTER(ctypes.c_double),  # winz : DOUBLE* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GLU32.dll')
gluProject = Fiddle::Function.new(
  lib['gluProject'],
  [
    Fiddle::TYPE_DOUBLE,  # objx : DOUBLE
    Fiddle::TYPE_DOUBLE,  # objy : DOUBLE
    Fiddle::TYPE_DOUBLE,  # objz : DOUBLE
    Fiddle::TYPE_VOIDP,  # modelMatrix : DOUBLE*
    Fiddle::TYPE_VOIDP,  # projMatrix : DOUBLE*
    Fiddle::TYPE_VOIDP,  # viewport : INT*
    Fiddle::TYPE_VOIDP,  # winx : DOUBLE* in/out
    Fiddle::TYPE_VOIDP,  # winy : DOUBLE* in/out
    Fiddle::TYPE_VOIDP,  # winz : DOUBLE* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "glu32")]
extern "system" {
    fn gluProject(
        objx: f64,  // DOUBLE
        objy: f64,  // DOUBLE
        objz: f64,  // DOUBLE
        modelMatrix: *const f64,  // DOUBLE*
        projMatrix: *const f64,  // DOUBLE*
        viewport: *const i32,  // INT*
        winx: *mut f64,  // DOUBLE* in/out
        winy: *mut f64,  // DOUBLE* in/out
        winz: *mut f64  // DOUBLE* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("GLU32.dll")]
public static extern int gluProject(double objx, double objy, double objz, ref double modelMatrix, ref double projMatrix, ref int viewport, ref double winx, ref double winy, ref double winz);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GLU32_gluProject' -Namespace Win32 -PassThru
# $api::gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz)
#uselib "GLU32.dll"
#func global gluProject "gluProject" double, double, double, sptr, sptr, sptr, sptr, sptr, sptr
; gluProject objx, objy, objz, varptr(modelMatrix), varptr(projMatrix), varptr(viewport), varptr(winx), varptr(winy), varptr(winz)   ; 戻り値は stat
; objx : DOUBLE -> "double"
; objy : DOUBLE -> "double"
; objz : DOUBLE -> "double"
; modelMatrix : DOUBLE* -> "sptr"
; projMatrix : DOUBLE* -> "sptr"
; viewport : INT* -> "sptr"
; winx : DOUBLE* in/out -> "sptr"
; winy : DOUBLE* in/out -> "sptr"
; winz : DOUBLE* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "GLU32.dll"
#cfunc global gluProject "gluProject" double, double, double, var, var, var, var, var, var
; res = gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz)
; objx : DOUBLE -> "double"
; objy : DOUBLE -> "double"
; objz : DOUBLE -> "double"
; modelMatrix : DOUBLE* -> "var"
; projMatrix : DOUBLE* -> "var"
; viewport : INT* -> "var"
; winx : DOUBLE* in/out -> "var"
; winy : DOUBLE* in/out -> "var"
; winz : DOUBLE* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT gluProject(DOUBLE objx, DOUBLE objy, DOUBLE objz, DOUBLE* modelMatrix, DOUBLE* projMatrix, INT* viewport, DOUBLE* winx, DOUBLE* winy, DOUBLE* winz)
#uselib "GLU32.dll"
#cfunc global gluProject "gluProject" double, double, double, var, var, var, var, var, var
; res = gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz)
; objx : DOUBLE -> "double"
; objy : DOUBLE -> "double"
; objz : DOUBLE -> "double"
; modelMatrix : DOUBLE* -> "var"
; projMatrix : DOUBLE* -> "var"
; viewport : INT* -> "var"
; winx : DOUBLE* in/out -> "var"
; winy : DOUBLE* in/out -> "var"
; winz : DOUBLE* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"math"
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	glu32 = windows.NewLazySystemDLL("GLU32.dll")
	procgluProject = glu32.NewProc("gluProject")
)

// objx (DOUBLE), objy (DOUBLE), objz (DOUBLE), modelMatrix (DOUBLE*), projMatrix (DOUBLE*), viewport (INT*), winx (DOUBLE* in/out), winy (DOUBLE* in/out), winz (DOUBLE* in/out)
r1, _, err := procgluProject.Call(
	uintptr(math.Float64bits(objx)),
	uintptr(math.Float64bits(objy)),
	uintptr(math.Float64bits(objz)),
	uintptr(modelMatrix),
	uintptr(projMatrix),
	uintptr(viewport),
	uintptr(winx),
	uintptr(winy),
	uintptr(winz),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。
function gluProject(
  objx: Double;   // DOUBLE
  objy: Double;   // DOUBLE
  objz: Double;   // DOUBLE
  modelMatrix: Pointer;   // DOUBLE*
  projMatrix: Pointer;   // DOUBLE*
  viewport: Pointer;   // INT*
  winx: Pointer;   // DOUBLE* in/out
  winy: Pointer;   // DOUBLE* in/out
  winz: Pointer   // DOUBLE* in/out
): Integer; stdcall;
  external 'GLU32.dll' name 'gluProject';
result := DllCall("GLU32\gluProject"
    , "Double", objx   ; DOUBLE
    , "Double", objy   ; DOUBLE
    , "Double", objz   ; DOUBLE
    , "Ptr", modelMatrix   ; DOUBLE*
    , "Ptr", projMatrix   ; DOUBLE*
    , "Ptr", viewport   ; INT*
    , "Ptr", winx   ; DOUBLE* in/out
    , "Ptr", winy   ; DOUBLE* in/out
    , "Ptr", winz   ; DOUBLE* in/out
    , "Int")   ; return: INT
●gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz) = DLL("GLU32.dll", "int gluProject(double, double, double, void*, void*, void*, void*, void*, void*)")
# 呼び出し: gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz)
# objx : DOUBLE -> "double"
# objy : DOUBLE -> "double"
# objz : DOUBLE -> "double"
# modelMatrix : DOUBLE* -> "void*"
# projMatrix : DOUBLE* -> "void*"
# viewport : INT* -> "void*"
# winx : DOUBLE* in/out -> "void*"
# winy : DOUBLE* in/out -> "void*"
# winz : DOUBLE* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "glu32" fn gluProject(
    objx: f64, // DOUBLE
    objy: f64, // DOUBLE
    objz: f64, // DOUBLE
    modelMatrix: [*c]f64, // DOUBLE*
    projMatrix: [*c]f64, // DOUBLE*
    viewport: [*c]i32, // INT*
    winx: [*c]f64, // DOUBLE* in/out
    winy: [*c]f64, // DOUBLE* in/out
    winz: [*c]f64 // DOUBLE* in/out
) callconv(std.os.windows.WINAPI) i32;
proc gluProject(
    objx: float64,  # DOUBLE
    objy: float64,  # DOUBLE
    objz: float64,  # DOUBLE
    modelMatrix: ptr float64,  # DOUBLE*
    projMatrix: ptr float64,  # DOUBLE*
    viewport: ptr int32,  # INT*
    winx: ptr float64,  # DOUBLE* in/out
    winy: ptr float64,  # DOUBLE* in/out
    winz: ptr float64  # DOUBLE* in/out
): int32 {.importc: "gluProject", stdcall, dynlib: "GLU32.dll".}
pragma(lib, "glu32");
extern(Windows)
int gluProject(
    double objx,   // DOUBLE
    double objy,   // DOUBLE
    double objz,   // DOUBLE
    double* modelMatrix,   // DOUBLE*
    double* projMatrix,   // DOUBLE*
    int* viewport,   // INT*
    double* winx,   // DOUBLE* in/out
    double* winy,   // DOUBLE* in/out
    double* winz   // DOUBLE* in/out
);
ccall((:gluProject, "GLU32.dll"), stdcall, Int32,
      (Float64, Float64, Float64, Ptr{Float64}, Ptr{Float64}, Ptr{Int32}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64}),
      objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz)
# objx : DOUBLE -> Float64
# objy : DOUBLE -> Float64
# objz : DOUBLE -> Float64
# modelMatrix : DOUBLE* -> Ptr{Float64}
# projMatrix : DOUBLE* -> Ptr{Float64}
# viewport : INT* -> Ptr{Int32}
# winx : DOUBLE* in/out -> Ptr{Float64}
# winy : DOUBLE* in/out -> Ptr{Float64}
# winz : DOUBLE* in/out -> Ptr{Float64}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t gluProject(
    double objx,
    double objy,
    double objz,
    double* modelMatrix,
    double* projMatrix,
    int32_t* viewport,
    double* winx,
    double* winy,
    double* winz);
]]
local glu32 = ffi.load("glu32")
-- glu32.gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz)
-- objx : DOUBLE
-- objy : DOUBLE
-- objz : DOUBLE
-- modelMatrix : DOUBLE*
-- projMatrix : DOUBLE*
-- viewport : INT*
-- winx : DOUBLE* in/out
-- winy : DOUBLE* in/out
-- winz : DOUBLE* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('GLU32.dll');
const gluProject = lib.func('__stdcall', 'gluProject', 'int32_t', ['double', 'double', 'double', 'double *', 'double *', 'int32_t *', 'double *', 'double *', 'double *']);
// gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz)
// objx : DOUBLE -> 'double'
// objy : DOUBLE -> 'double'
// objz : DOUBLE -> 'double'
// modelMatrix : DOUBLE* -> 'double *'
// projMatrix : DOUBLE* -> 'double *'
// viewport : INT* -> 'int32_t *'
// winx : DOUBLE* in/out -> 'double *'
// winy : DOUBLE* in/out -> 'double *'
// winz : DOUBLE* in/out -> 'double *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("GLU32.dll", {
  gluProject: { parameters: ["f64", "f64", "f64", "pointer", "pointer", "pointer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz)
// objx : DOUBLE -> "f64"
// objy : DOUBLE -> "f64"
// objz : DOUBLE -> "f64"
// modelMatrix : DOUBLE* -> "pointer"
// projMatrix : DOUBLE* -> "pointer"
// viewport : INT* -> "pointer"
// winx : DOUBLE* in/out -> "pointer"
// winy : DOUBLE* in/out -> "pointer"
// winz : DOUBLE* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t gluProject(
    double objx,
    double objy,
    double objz,
    double* modelMatrix,
    double* projMatrix,
    int32_t* viewport,
    double* winx,
    double* winy,
    double* winz);
C, "GLU32.dll");
// $ffi->gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz);
// objx : DOUBLE
// objy : DOUBLE
// objz : DOUBLE
// modelMatrix : DOUBLE*
// projMatrix : DOUBLE*
// viewport : INT*
// winx : DOUBLE* in/out
// winy : DOUBLE* in/out
// winz : DOUBLE* in/out
// 構造体/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 Glu32 extends StdCallLibrary {
    Glu32 INSTANCE = Native.load("glu32", Glu32.class);
    int gluProject(
        double objx,   // DOUBLE
        double objy,   // DOUBLE
        double objz,   // DOUBLE
        DoubleByReference modelMatrix,   // DOUBLE*
        DoubleByReference projMatrix,   // DOUBLE*
        IntByReference viewport,   // INT*
        DoubleByReference winx,   // DOUBLE* in/out
        DoubleByReference winy,   // DOUBLE* in/out
        DoubleByReference winz   // DOUBLE* in/out
    );
}
@[Link("glu32")]
lib LibGLU32
  fun gluProject = gluProject(
    objx : Float64,   # DOUBLE
    objy : Float64,   # DOUBLE
    objz : Float64,   # DOUBLE
    modelMatrix : Float64*,   # DOUBLE*
    projMatrix : Float64*,   # DOUBLE*
    viewport : Int32*,   # INT*
    winx : Float64*,   # DOUBLE* in/out
    winy : Float64*,   # DOUBLE* in/out
    winz : Float64*   # DOUBLE* in/out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef gluProjectNative = Int32 Function(Double, Double, Double, Pointer<Double>, Pointer<Double>, Pointer<Int32>, Pointer<Double>, Pointer<Double>, Pointer<Double>);
typedef gluProjectDart = int Function(double, double, double, Pointer<Double>, Pointer<Double>, Pointer<Int32>, Pointer<Double>, Pointer<Double>, Pointer<Double>);
final gluProject = DynamicLibrary.open('GLU32.dll')
    .lookupFunction<gluProjectNative, gluProjectDart>('gluProject');
// objx : DOUBLE -> Double
// objy : DOUBLE -> Double
// objz : DOUBLE -> Double
// modelMatrix : DOUBLE* -> Pointer<Double>
// projMatrix : DOUBLE* -> Pointer<Double>
// viewport : INT* -> Pointer<Int32>
// winx : DOUBLE* in/out -> Pointer<Double>
// winy : DOUBLE* in/out -> Pointer<Double>
// winz : DOUBLE* in/out -> Pointer<Double>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function gluProject(
  objx: Double;   // DOUBLE
  objy: Double;   // DOUBLE
  objz: Double;   // DOUBLE
  modelMatrix: Pointer;   // DOUBLE*
  projMatrix: Pointer;   // DOUBLE*
  viewport: Pointer;   // INT*
  winx: Pointer;   // DOUBLE* in/out
  winy: Pointer;   // DOUBLE* in/out
  winz: Pointer   // DOUBLE* in/out
): Integer; stdcall;
  external 'GLU32.dll' name 'gluProject';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "gluProject"
  c_gluProject :: CDouble -> CDouble -> CDouble -> Ptr CDouble -> Ptr CDouble -> Ptr Int32 -> Ptr CDouble -> Ptr CDouble -> Ptr CDouble -> IO Int32
-- objx : DOUBLE -> CDouble
-- objy : DOUBLE -> CDouble
-- objz : DOUBLE -> CDouble
-- modelMatrix : DOUBLE* -> Ptr CDouble
-- projMatrix : DOUBLE* -> Ptr CDouble
-- viewport : INT* -> Ptr Int32
-- winx : DOUBLE* in/out -> Ptr CDouble
-- winy : DOUBLE* in/out -> Ptr CDouble
-- winz : DOUBLE* in/out -> Ptr CDouble
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let gluproject =
  foreign "gluProject"
    (double @-> double @-> double @-> (ptr double) @-> (ptr double) @-> (ptr int32_t) @-> (ptr double) @-> (ptr double) @-> (ptr double) @-> returning int32_t)
(* objx : DOUBLE -> double *)
(* objy : DOUBLE -> double *)
(* objz : DOUBLE -> double *)
(* modelMatrix : DOUBLE* -> (ptr double) *)
(* projMatrix : DOUBLE* -> (ptr double) *)
(* viewport : INT* -> (ptr int32_t) *)
(* winx : DOUBLE* in/out -> (ptr double) *)
(* winy : DOUBLE* in/out -> (ptr double) *)
(* winz : DOUBLE* in/out -> (ptr double) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library glu32 (t "GLU32.dll"))
(cffi:use-foreign-library glu32)

(cffi:defcfun ("gluProject" glu-project :convention :stdcall) :int32
  (objx :double)   ; DOUBLE
  (objy :double)   ; DOUBLE
  (objz :double)   ; DOUBLE
  (model-matrix :pointer)   ; DOUBLE*
  (proj-matrix :pointer)   ; DOUBLE*
  (viewport :pointer)   ; INT*
  (winx :pointer)   ; DOUBLE* in/out
  (winy :pointer)   ; DOUBLE* in/out
  (winz :pointer))   ; DOUBLE* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $gluProject = Win32::API::More->new('GLU32',
    'int gluProject(double objx, double objy, double objz, LPVOID modelMatrix, LPVOID projMatrix, LPVOID viewport, LPVOID winx, LPVOID winy, LPVOID winz)');
# my $ret = $gluProject->Call($objx, $objy, $objz, $modelMatrix, $projMatrix, $viewport, $winx, $winy, $winz);
# objx : DOUBLE -> double
# objy : DOUBLE -> double
# objz : DOUBLE -> double
# modelMatrix : DOUBLE* -> LPVOID
# projMatrix : DOUBLE* -> LPVOID
# viewport : INT* -> LPVOID
# winx : DOUBLE* in/out -> LPVOID
# winy : DOUBLE* in/out -> LPVOID
# winz : DOUBLE* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。