DROPFILES
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| pFiles | DWORD | 4 | +0 | +0 | 構造体先頭からファイル名リストまでのバイトオフセット。 |
| pt | POINT | 8 | +4 | +4 | ドロップ位置の座標(POINT)。 |
| fNC | BOOL | 4 | +12 | +12 | 座標が非クライアント領域基準かを示すブール値。 |
| fWide | BOOL | 4 | +16 | +16 | ファイル名リストがUnicodeかANSIかを示すブール値。TRUEでUnicode。 |
各言語での定義
#include <windows.h>
// POINT (x64 8 / x86 8 バイト)
typedef struct POINT {
INT x;
INT y;
} POINT;
// DROPFILES (x64 20 / x86 20 バイト)
#pragma pack(push, 1)
typedef struct DROPFILES {
DWORD pFiles;
POINT pt;
BOOL fNC;
BOOL fWide;
} DROPFILES;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINT
{
public int x;
public int y;
}
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct DROPFILES
{
public uint pFiles;
public POINT pt;
[MarshalAs(UnmanagedType.Bool)] public bool fNC;
[MarshalAs(UnmanagedType.Bool)] public bool fWide;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINT
Public x As Integer
Public y As Integer
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure DROPFILES
Public pFiles As UInteger
Public pt As POINT
<MarshalAs(UnmanagedType.Bool)> Public fNC As Boolean
<MarshalAs(UnmanagedType.Bool)> Public fWide As Boolean
End Structureimport ctypes
from ctypes import wintypes
class POINT(ctypes.Structure):
_fields_ = [
("x", ctypes.c_int),
("y", ctypes.c_int),
]
class DROPFILES(ctypes.Structure):
_pack_ = 1
_fields_ = [
("pFiles", wintypes.DWORD),
("pt", POINT),
("fNC", wintypes.BOOL),
("fWide", wintypes.BOOL),
]#[repr(C)]
pub struct POINT {
pub x: i32,
pub y: i32,
}
#[repr(C, packed(1))]
pub struct DROPFILES {
pub pFiles: u32,
pub pt: POINT,
pub fNC: i32,
pub fWide: i32,
}import "golang.org/x/sys/windows"
type POINT struct {
x int32
y int32
}
type DROPFILES struct {
pFiles uint32
pt POINT
fNC int32
fWide int32
}type
POINT = record
x: Integer;
y: Integer;
end;
DROPFILES = packed record
pFiles: DWORD;
pt: POINT;
fNC: BOOL;
fWide: BOOL;
end;const POINT = extern struct {
x: i32,
y: i32,
};
const DROPFILES = extern struct {
pFiles: u32,
pt: POINT,
fNC: i32,
fWide: i32,
};type
POINT {.bycopy.} = object
x: int32
y: int32
DROPFILES {.packed.} = object
pFiles: uint32
pt: POINT
fNC: int32
fWide: int32struct POINT
{
int x;
int y;
}
align(1)
struct DROPFILES
{
uint pFiles;
POINT pt;
int fNC;
int fWide;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DROPFILES サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; pFiles : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pt : POINT (+4, 8byte) varptr(st)+4 を基点に操作(8byte:入れ子/配列)
; fNC : BOOL (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; fWide : BOOL (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global POINT
#field int x
#field int y
#endstruct
#defstruct global DROPFILES, pack=1
#field int pFiles
#field POINT pt
#field bool fNC
#field bool fWide
#endstruct
stdim st, DROPFILES ; NSTRUCT 変数を確保
st->pFiles = 100
mes "pFiles=" + st->pFiles