SHDRAGIMAGE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| sizeDragImage | SIZE | 8 | +0 | +0 | ドラッグイメージのサイズ(SIZE、ピクセル)。 |
| ptOffset | POINT | 8 | +8 | +8 | カーソルからのドラッグイメージのオフセット(POINT)。 |
| hbmpDragImage | HBITMAP | 8/4 | +16 | +16 | ドラッグ中に表示するビットマップのハンドル。 |
| crColorKey | COLORREF | 4 | +24 | +20 | 透明色として扱う色(COLORREF)。 |
各言語での定義
#include <windows.h>
// SIZE (x64 8 / x86 8 バイト)
typedef struct SIZE {
INT cx;
INT cy;
} SIZE;
// POINT (x64 8 / x86 8 バイト)
typedef struct POINT {
INT x;
INT y;
} POINT;
// SHDRAGIMAGE (x64 32 / x86 24 バイト)
typedef struct SHDRAGIMAGE {
SIZE sizeDragImage;
POINT ptOffset;
HBITMAP hbmpDragImage;
COLORREF crColorKey;
} SHDRAGIMAGE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SIZE
{
public int cx;
public int cy;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINT
{
public int x;
public int y;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SHDRAGIMAGE
{
public SIZE sizeDragImage;
public POINT ptOffset;
public IntPtr hbmpDragImage;
public uint crColorKey;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SIZE
Public cx As Integer
Public cy As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINT
Public x As Integer
Public y As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SHDRAGIMAGE
Public sizeDragImage As SIZE
Public ptOffset As POINT
Public hbmpDragImage As IntPtr
Public crColorKey As UInteger
End Structureimport ctypes
from ctypes import wintypes
class SIZE(ctypes.Structure):
_fields_ = [
("cx", ctypes.c_int),
("cy", ctypes.c_int),
]
class POINT(ctypes.Structure):
_fields_ = [
("x", ctypes.c_int),
("y", ctypes.c_int),
]
class SHDRAGIMAGE(ctypes.Structure):
_fields_ = [
("sizeDragImage", SIZE),
("ptOffset", POINT),
("hbmpDragImage", ctypes.c_void_p),
("crColorKey", wintypes.DWORD),
]#[repr(C)]
pub struct SIZE {
pub cx: i32,
pub cy: i32,
}
#[repr(C)]
pub struct POINT {
pub x: i32,
pub y: i32,
}
#[repr(C)]
pub struct SHDRAGIMAGE {
pub sizeDragImage: SIZE,
pub ptOffset: POINT,
pub hbmpDragImage: *mut core::ffi::c_void,
pub crColorKey: u32,
}import "golang.org/x/sys/windows"
type SIZE struct {
cx int32
cy int32
}
type POINT struct {
x int32
y int32
}
type SHDRAGIMAGE struct {
sizeDragImage SIZE
ptOffset POINT
hbmpDragImage uintptr
crColorKey uint32
}type
SIZE = record
cx: Integer;
cy: Integer;
end;
POINT = record
x: Integer;
y: Integer;
end;
SHDRAGIMAGE = record
sizeDragImage: SIZE;
ptOffset: POINT;
hbmpDragImage: Pointer;
crColorKey: DWORD;
end;const SIZE = extern struct {
cx: i32,
cy: i32,
};
const POINT = extern struct {
x: i32,
y: i32,
};
const SHDRAGIMAGE = extern struct {
sizeDragImage: SIZE,
ptOffset: POINT,
hbmpDragImage: ?*anyopaque,
crColorKey: u32,
};type
SIZE {.bycopy.} = object
cx: int32
cy: int32
POINT {.bycopy.} = object
x: int32
y: int32
SHDRAGIMAGE {.bycopy.} = object
sizeDragImage: SIZE
ptOffset: POINT
hbmpDragImage: pointer
crColorKey: uint32struct SIZE
{
int cx;
int cy;
}
struct POINT
{
int x;
int y;
}
struct SHDRAGIMAGE
{
SIZE sizeDragImage;
POINT ptOffset;
void* hbmpDragImage;
uint crColorKey;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SHDRAGIMAGE サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; sizeDragImage : SIZE (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; ptOffset : POINT (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; hbmpDragImage : HBITMAP (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; crColorKey : COLORREF (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SHDRAGIMAGE サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; sizeDragImage : SIZE (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; ptOffset : POINT (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; hbmpDragImage : HBITMAP (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; crColorKey : COLORREF (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SIZE
#field int cx
#field int cy
#endstruct
#defstruct global POINT
#field int x
#field int y
#endstruct
#defstruct global SHDRAGIMAGE
#field SIZE sizeDragImage
#field POINT ptOffset
#field intptr hbmpDragImage
#field int crColorKey
#endstruct
stdim st, SHDRAGIMAGE ; NSTRUCT 変数を確保
st->crColorKey = 100
mes "crColorKey=" + st->crColorKey