DROPDESCRIPTION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| type | DROPIMAGETYPE | 4 | +0 | +0 | ドロップ時に表示するイメージの種類(コピー・移動・リンク等)。 |
| szMessage | WCHAR | 520 | +4 | +4 | ドロップ時に表示するメッセージ文字列(Unicode固定長配列)。 |
| szInsert | WCHAR | 520 | +524 | +524 | メッセージ内の%1に挿入される文字列(Unicode固定長配列)。 |
各言語での定義
#include <windows.h>
// DROPDESCRIPTION (x64 1044 / x86 1044 バイト)
#pragma pack(push, 1)
typedef struct DROPDESCRIPTION {
DROPIMAGETYPE type;
WCHAR szMessage[260];
WCHAR szInsert[260];
} DROPDESCRIPTION;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct DROPDESCRIPTION
{
public int type;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szMessage;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szInsert;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure DROPDESCRIPTION
Public type As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public szMessage As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public szInsert As String
End Structureimport ctypes
from ctypes import wintypes
class DROPDESCRIPTION(ctypes.Structure):
_pack_ = 1
_fields_ = [
("type", ctypes.c_int),
("szMessage", ctypes.c_wchar * 260),
("szInsert", ctypes.c_wchar * 260),
]#[repr(C, packed(1))]
pub struct DROPDESCRIPTION {
pub type: i32,
pub szMessage: [u16; 260],
pub szInsert: [u16; 260],
}import "golang.org/x/sys/windows"
type DROPDESCRIPTION struct {
type int32
szMessage [260]uint16
szInsert [260]uint16
}type
DROPDESCRIPTION = packed record
type: Integer;
szMessage: array[0..259] of WideChar;
szInsert: array[0..259] of WideChar;
end;const DROPDESCRIPTION = extern struct {
type: i32,
szMessage: [260]u16,
szInsert: [260]u16,
};type
DROPDESCRIPTION {.packed.} = object
type: int32
szMessage: array[260, uint16]
szInsert: array[260, uint16]align(1)
struct DROPDESCRIPTION
{
int type;
wchar[260] szMessage;
wchar[260] szInsert;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DROPDESCRIPTION サイズ: 1044 バイト(x64)
dim st, 261 ; 4byte整数×261(構造体サイズ 1044 / 4 切り上げ)
; type : DROPIMAGETYPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; szMessage : WCHAR (+4, 520byte) varptr(st)+4 を基点に操作(520byte:入れ子/配列)
; szInsert : WCHAR (+524, 520byte) varptr(st)+524 を基点に操作(520byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DROPDESCRIPTION, pack=1
#field int type
#field wchar szMessage 260
#field wchar szInsert 260
#endstruct
stdim st, DROPDESCRIPTION ; NSTRUCT 変数を確保
st->type = 100
mes "type=" + st->type