ホーム › UI.Controls.Dialogs › OPENFILENAME_NT4W
OPENFILENAME_NT4W
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| lStructSize | DWORD | 4 | +0 | +0 | この構造体のサイズをバイト単位で指定する。NT4互換の旧サイズを表す。 |
| hwndOwner | HWND | 8/4 | +4 | +4 | ダイアログを所有する親ウィンドウのハンドル。NULL可。 |
| hInstance | HINSTANCE | 8/4 | +12 | +8 | カスタムテンプレートを含むモジュールのインスタンスハンドル。 |
| lpstrFilter | LPWSTR | 8/4 | +20 | +12 | ファイル種別フィルタを表すヌル区切り文字列のペア。最後は二重ヌルで終端する。NULL可。 |
| lpstrCustomFilter | LPWSTR | 8/4 | +28 | +16 | ユーザー選択フィルタを保持する文字列バッファ。NULL可。 |
| nMaxCustFilter | DWORD | 4 | +36 | +20 | lpstrCustomFilterバッファのサイズを文字数で指定する。 |
| nFilterIndex | DWORD | 4 | +40 | +24 | 初期選択するフィルタの1始まりのインデックス。0はカスタムフィルタを示す。 |
| lpstrFile | LPWSTR | 8/4 | +44 | +28 | 初期ファイル名と選択結果のフルパスを保持するバッファ。 |
| nMaxFile | DWORD | 4 | +52 | +32 | lpstrFileバッファのサイズを文字数で指定する。 |
| lpstrFileTitle | LPWSTR | 8/4 | +56 | +36 | 選択ファイルのファイル名部分(パスなし)を受け取るバッファ。NULL可。 |
| nMaxFileTitle | DWORD | 4 | +64 | +40 | lpstrFileTitleバッファのサイズを文字数で指定する。 |
| lpstrInitialDir | LPWSTR | 8/4 | +68 | +44 | 初期表示するディレクトリのパス。NULL可。 |
| lpstrTitle | LPWSTR | 8/4 | +76 | +48 | ダイアログのタイトルバーに表示する文字列。NULL可。 |
| Flags | DWORD | 4 | +84 | +52 | ダイアログの動作を制御するOFN_系フラグの組み合わせ。 |
| nFileOffset | WORD | 2 | +88 | +56 | lpstrFile内でファイル名が始まる位置を文字単位で受け取る。 |
| nFileExtension | WORD | 2 | +90 | +58 | lpstrFile内で拡張子が始まる位置を文字単位で受け取る。 |
| lpstrDefExt | LPWSTR | 8/4 | +92 | +60 | 拡張子省略時に付加される既定の拡張子。先頭ピリオドなし。NULL可。 |
| lCustData | LPARAM | 8/4 | +100 | +64 | フックプロシージャに渡されるアプリケーション定義データ。 |
| lpfnHook | LPOFNHOOKPROC | 8/4 | +108 | +68 | メッセージを処理するフックプロシージャへのポインタ。OFN_ENABLEHOOK時に有効。 |
| lpTemplateName | LPWSTR | 8/4 | +116 | +72 | OFN_ENABLETEMPLATE指定時のダイアログテンプレートのリソース名。 |
各言語での定義
#include <windows.h>
// OPENFILENAME_NT4W (x64 124 / x86 76 バイト)
#pragma pack(push, 1)
typedef struct OPENFILENAME_NT4W {
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
LPWSTR lpstrFilter;
LPWSTR lpstrCustomFilter;
DWORD nMaxCustFilter;
DWORD nFilterIndex;
LPWSTR lpstrFile;
DWORD nMaxFile;
LPWSTR lpstrFileTitle;
DWORD nMaxFileTitle;
LPWSTR lpstrInitialDir;
LPWSTR lpstrTitle;
DWORD Flags;
WORD nFileOffset;
WORD nFileExtension;
LPWSTR lpstrDefExt;
LPARAM lCustData;
LPOFNHOOKPROC lpfnHook;
LPWSTR lpTemplateName;
} OPENFILENAME_NT4W;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct OPENFILENAME_NT4W
{
public uint lStructSize;
public IntPtr hwndOwner;
public IntPtr hInstance;
public IntPtr lpstrFilter;
public IntPtr lpstrCustomFilter;
public uint nMaxCustFilter;
public uint nFilterIndex;
public IntPtr lpstrFile;
public uint nMaxFile;
public IntPtr lpstrFileTitle;
public uint nMaxFileTitle;
public IntPtr lpstrInitialDir;
public IntPtr lpstrTitle;
public uint Flags;
public ushort nFileOffset;
public ushort nFileExtension;
public IntPtr lpstrDefExt;
public IntPtr lCustData;
public IntPtr lpfnHook;
public IntPtr lpTemplateName;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure OPENFILENAME_NT4W
Public lStructSize As UInteger
Public hwndOwner As IntPtr
Public hInstance As IntPtr
Public lpstrFilter As IntPtr
Public lpstrCustomFilter As IntPtr
Public nMaxCustFilter As UInteger
Public nFilterIndex As UInteger
Public lpstrFile As IntPtr
Public nMaxFile As UInteger
Public lpstrFileTitle As IntPtr
Public nMaxFileTitle As UInteger
Public lpstrInitialDir As IntPtr
Public lpstrTitle As IntPtr
Public Flags As UInteger
Public nFileOffset As UShort
Public nFileExtension As UShort
Public lpstrDefExt As IntPtr
Public lCustData As IntPtr
Public lpfnHook As IntPtr
Public lpTemplateName As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class OPENFILENAME_NT4W(ctypes.Structure):
_pack_ = 1
_fields_ = [
("lStructSize", wintypes.DWORD),
("hwndOwner", ctypes.c_void_p),
("hInstance", ctypes.c_void_p),
("lpstrFilter", ctypes.c_void_p),
("lpstrCustomFilter", ctypes.c_void_p),
("nMaxCustFilter", wintypes.DWORD),
("nFilterIndex", wintypes.DWORD),
("lpstrFile", ctypes.c_void_p),
("nMaxFile", wintypes.DWORD),
("lpstrFileTitle", ctypes.c_void_p),
("nMaxFileTitle", wintypes.DWORD),
("lpstrInitialDir", ctypes.c_void_p),
("lpstrTitle", ctypes.c_void_p),
("Flags", wintypes.DWORD),
("nFileOffset", ctypes.c_ushort),
("nFileExtension", ctypes.c_ushort),
("lpstrDefExt", ctypes.c_void_p),
("lCustData", ctypes.c_ssize_t),
("lpfnHook", ctypes.c_void_p),
("lpTemplateName", ctypes.c_void_p),
]#[repr(C, packed(1))]
pub struct OPENFILENAME_NT4W {
pub lStructSize: u32,
pub hwndOwner: *mut core::ffi::c_void,
pub hInstance: *mut core::ffi::c_void,
pub lpstrFilter: *mut core::ffi::c_void,
pub lpstrCustomFilter: *mut core::ffi::c_void,
pub nMaxCustFilter: u32,
pub nFilterIndex: u32,
pub lpstrFile: *mut core::ffi::c_void,
pub nMaxFile: u32,
pub lpstrFileTitle: *mut core::ffi::c_void,
pub nMaxFileTitle: u32,
pub lpstrInitialDir: *mut core::ffi::c_void,
pub lpstrTitle: *mut core::ffi::c_void,
pub Flags: u32,
pub nFileOffset: u16,
pub nFileExtension: u16,
pub lpstrDefExt: *mut core::ffi::c_void,
pub lCustData: isize,
pub lpfnHook: *mut core::ffi::c_void,
pub lpTemplateName: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type OPENFILENAME_NT4W struct {
lStructSize uint32
hwndOwner uintptr
hInstance uintptr
lpstrFilter uintptr
lpstrCustomFilter uintptr
nMaxCustFilter uint32
nFilterIndex uint32
lpstrFile uintptr
nMaxFile uint32
lpstrFileTitle uintptr
nMaxFileTitle uint32
lpstrInitialDir uintptr
lpstrTitle uintptr
Flags uint32
nFileOffset uint16
nFileExtension uint16
lpstrDefExt uintptr
lCustData uintptr
lpfnHook uintptr
lpTemplateName uintptr
}type
OPENFILENAME_NT4W = packed record
lStructSize: DWORD;
hwndOwner: Pointer;
hInstance: Pointer;
lpstrFilter: Pointer;
lpstrCustomFilter: Pointer;
nMaxCustFilter: DWORD;
nFilterIndex: DWORD;
lpstrFile: Pointer;
nMaxFile: DWORD;
lpstrFileTitle: Pointer;
nMaxFileTitle: DWORD;
lpstrInitialDir: Pointer;
lpstrTitle: Pointer;
Flags: DWORD;
nFileOffset: Word;
nFileExtension: Word;
lpstrDefExt: Pointer;
lCustData: NativeInt;
lpfnHook: Pointer;
lpTemplateName: Pointer;
end;const OPENFILENAME_NT4W = extern struct {
lStructSize: u32,
hwndOwner: ?*anyopaque,
hInstance: ?*anyopaque,
lpstrFilter: ?*anyopaque,
lpstrCustomFilter: ?*anyopaque,
nMaxCustFilter: u32,
nFilterIndex: u32,
lpstrFile: ?*anyopaque,
nMaxFile: u32,
lpstrFileTitle: ?*anyopaque,
nMaxFileTitle: u32,
lpstrInitialDir: ?*anyopaque,
lpstrTitle: ?*anyopaque,
Flags: u32,
nFileOffset: u16,
nFileExtension: u16,
lpstrDefExt: ?*anyopaque,
lCustData: isize,
lpfnHook: ?*anyopaque,
lpTemplateName: ?*anyopaque,
};type
OPENFILENAME_NT4W {.packed.} = object
lStructSize: uint32
hwndOwner: pointer
hInstance: pointer
lpstrFilter: pointer
lpstrCustomFilter: pointer
nMaxCustFilter: uint32
nFilterIndex: uint32
lpstrFile: pointer
nMaxFile: uint32
lpstrFileTitle: pointer
nMaxFileTitle: uint32
lpstrInitialDir: pointer
lpstrTitle: pointer
Flags: uint32
nFileOffset: uint16
nFileExtension: uint16
lpstrDefExt: pointer
lCustData: int
lpfnHook: pointer
lpTemplateName: pointeralign(1)
struct OPENFILENAME_NT4W
{
uint lStructSize;
void* hwndOwner;
void* hInstance;
void* lpstrFilter;
void* lpstrCustomFilter;
uint nMaxCustFilter;
uint nFilterIndex;
void* lpstrFile;
uint nMaxFile;
void* lpstrFileTitle;
uint nMaxFileTitle;
void* lpstrInitialDir;
void* lpstrTitle;
uint Flags;
ushort nFileOffset;
ushort nFileExtension;
void* lpstrDefExt;
ptrdiff_t lCustData;
void* lpfnHook;
void* lpTemplateName;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; OPENFILENAME_NT4W サイズ: 76 バイト(x86)
dim st, 19 ; 4byte整数×19(構造体サイズ 76 / 4 切り上げ)
; lStructSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hwndOwner : HWND (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hInstance : HINSTANCE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; lpstrFilter : LPWSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; lpstrCustomFilter : LPWSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; nMaxCustFilter : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; nFilterIndex : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; lpstrFile : LPWSTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; nMaxFile : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; lpstrFileTitle : LPWSTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; nMaxFileTitle : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; lpstrInitialDir : LPWSTR (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; lpstrTitle : LPWSTR (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; Flags : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; nFileOffset : WORD (+56, 2byte) wpoke st,56,値 / 値 = wpeek(st,56)
; nFileExtension : WORD (+58, 2byte) wpoke st,58,値 / 値 = wpeek(st,58)
; lpstrDefExt : LPWSTR (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; lCustData : LPARAM (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; lpfnHook : LPOFNHOOKPROC (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; lpTemplateName : LPWSTR (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; OPENFILENAME_NT4W サイズ: 124 バイト(x64)
dim st, 31 ; 4byte整数×31(構造体サイズ 124 / 4 切り上げ)
; lStructSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hwndOwner : HWND (+4, 8byte) qpoke st,4,値 / qpeek(st,4) ※IronHSPのみ。3.7/3.8は lpoke st,4,下位 : lpoke st,8,上位
; hInstance : HINSTANCE (+12, 8byte) qpoke st,12,値 / qpeek(st,12) ※IronHSPのみ。3.7/3.8は lpoke st,12,下位 : lpoke st,16,上位
; lpstrFilter : LPWSTR (+20, 8byte) qpoke st,20,値 / qpeek(st,20) ※IronHSPのみ。3.7/3.8は lpoke st,20,下位 : lpoke st,24,上位
; lpstrCustomFilter : LPWSTR (+28, 8byte) qpoke st,28,値 / qpeek(st,28) ※IronHSPのみ。3.7/3.8は lpoke st,28,下位 : lpoke st,32,上位
; nMaxCustFilter : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; nFilterIndex : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; lpstrFile : LPWSTR (+44, 8byte) qpoke st,44,値 / qpeek(st,44) ※IronHSPのみ。3.7/3.8は lpoke st,44,下位 : lpoke st,48,上位
; nMaxFile : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; lpstrFileTitle : LPWSTR (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; nMaxFileTitle : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; lpstrInitialDir : LPWSTR (+68, 8byte) qpoke st,68,値 / qpeek(st,68) ※IronHSPのみ。3.7/3.8は lpoke st,68,下位 : lpoke st,72,上位
; lpstrTitle : LPWSTR (+76, 8byte) qpoke st,76,値 / qpeek(st,76) ※IronHSPのみ。3.7/3.8は lpoke st,76,下位 : lpoke st,80,上位
; Flags : DWORD (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; nFileOffset : WORD (+88, 2byte) wpoke st,88,値 / 値 = wpeek(st,88)
; nFileExtension : WORD (+90, 2byte) wpoke st,90,値 / 値 = wpeek(st,90)
; lpstrDefExt : LPWSTR (+92, 8byte) qpoke st,92,値 / qpeek(st,92) ※IronHSPのみ。3.7/3.8は lpoke st,92,下位 : lpoke st,96,上位
; lCustData : LPARAM (+100, 8byte) qpoke st,100,値 / qpeek(st,100) ※IronHSPのみ。3.7/3.8は lpoke st,100,下位 : lpoke st,104,上位
; lpfnHook : LPOFNHOOKPROC (+108, 8byte) qpoke st,108,値 / qpeek(st,108) ※IronHSPのみ。3.7/3.8は lpoke st,108,下位 : lpoke st,112,上位
; lpTemplateName : LPWSTR (+116, 8byte) qpoke st,116,値 / qpeek(st,116) ※IronHSPのみ。3.7/3.8は lpoke st,116,下位 : lpoke st,120,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global OPENFILENAME_NT4W, pack=1
#field int lStructSize
#field intptr hwndOwner
#field intptr hInstance
#field intptr lpstrFilter
#field intptr lpstrCustomFilter
#field int nMaxCustFilter
#field int nFilterIndex
#field intptr lpstrFile
#field int nMaxFile
#field intptr lpstrFileTitle
#field int nMaxFileTitle
#field intptr lpstrInitialDir
#field intptr lpstrTitle
#field int Flags
#field short nFileOffset
#field short nFileExtension
#field intptr lpstrDefExt
#field intptr lCustData
#field intptr lpfnHook
#field intptr lpTemplateName
#endstruct
stdim st, OPENFILENAME_NT4W ; NSTRUCT 変数を確保
st->lStructSize = 100
mes "lStructSize=" + st->lStructSize