Win32 API 日本語リファレンス
ホームUI.Shell.PropertiesSystem › PROPPRG

PROPPRG

構造体
サイズx64: 658 バイト / x86: 658 バイトパッキング1

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
flPrgWORD2+0+0PIF プログラムの全般オプションフラグ。
flPrgInitWORD2+2+2プログラム初期化時のオプションフラグ。
achTitleCHAR30+4+4プログラムのタイトル文字列(ANSI)。
achCmdLineCHAR128+34+34起動コマンドライン文字列(ANSI)。
achWorkDirCHAR64+162+162作業ディレクトリのパス(ANSI)。
wHotKeyWORD2+226+226プログラムに割り当てるホットキー。
achIconFileCHAR80+228+228アイコンを含むファイルのパス(ANSI)。
wIconIndexWORD2+308+308achIconFile 内のアイコンインデックス。
dwEnhModeFlagsDWORD4+310+310拡張モード(386 拡張)用のフラグ群。
dwRealModeFlagsDWORD4+314+314リアルモード用のフラグ群。
achOtherFileCHAR80+318+318関連付けられた別ファイルのパス(ANSI)。
achPIFFileCHAR260+398+398対応する PIF ファイルのパス(ANSI)。

各言語での定義

#include <windows.h>

// PROPPRG  (x64 658 / x86 658 バイト)
#pragma pack(push, 1)
typedef struct PROPPRG {
    WORD flPrg;
    WORD flPrgInit;
    CHAR achTitle[30];
    CHAR achCmdLine[128];
    CHAR achWorkDir[64];
    WORD wHotKey;
    CHAR achIconFile[80];
    WORD wIconIndex;
    DWORD dwEnhModeFlags;
    DWORD dwRealModeFlags;
    CHAR achOtherFile[80];
    CHAR achPIFFile[260];
} PROPPRG;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct PROPPRG
{
    public ushort flPrg;
    public ushort flPrgInit;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 30)] public sbyte[] achTitle;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public sbyte[] achCmdLine;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public sbyte[] achWorkDir;
    public ushort wHotKey;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] public sbyte[] achIconFile;
    public ushort wIconIndex;
    public uint dwEnhModeFlags;
    public uint dwRealModeFlags;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] public sbyte[] achOtherFile;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 260)] public sbyte[] achPIFFile;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure PROPPRG
    Public flPrg As UShort
    Public flPrgInit As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=30)> Public achTitle() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=128)> Public achCmdLine() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=64)> Public achWorkDir() As SByte
    Public wHotKey As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=80)> Public achIconFile() As SByte
    Public wIconIndex As UShort
    Public dwEnhModeFlags As UInteger
    Public dwRealModeFlags As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=80)> Public achOtherFile() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=260)> Public achPIFFile() As SByte
End Structure
import ctypes
from ctypes import wintypes

class PROPPRG(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("flPrg", ctypes.c_ushort),
        ("flPrgInit", ctypes.c_ushort),
        ("achTitle", ctypes.c_byte * 30),
        ("achCmdLine", ctypes.c_byte * 128),
        ("achWorkDir", ctypes.c_byte * 64),
        ("wHotKey", ctypes.c_ushort),
        ("achIconFile", ctypes.c_byte * 80),
        ("wIconIndex", ctypes.c_ushort),
        ("dwEnhModeFlags", wintypes.DWORD),
        ("dwRealModeFlags", wintypes.DWORD),
        ("achOtherFile", ctypes.c_byte * 80),
        ("achPIFFile", ctypes.c_byte * 260),
    ]
#[repr(C, packed(1))]
pub struct PROPPRG {
    pub flPrg: u16,
    pub flPrgInit: u16,
    pub achTitle: [i8; 30],
    pub achCmdLine: [i8; 128],
    pub achWorkDir: [i8; 64],
    pub wHotKey: u16,
    pub achIconFile: [i8; 80],
    pub wIconIndex: u16,
    pub dwEnhModeFlags: u32,
    pub dwRealModeFlags: u32,
    pub achOtherFile: [i8; 80],
    pub achPIFFile: [i8; 260],
}
import "golang.org/x/sys/windows"

type PROPPRG struct {
	flPrg uint16
	flPrgInit uint16
	achTitle [30]int8
	achCmdLine [128]int8
	achWorkDir [64]int8
	wHotKey uint16
	achIconFile [80]int8
	wIconIndex uint16
	dwEnhModeFlags uint32
	dwRealModeFlags uint32
	achOtherFile [80]int8
	achPIFFile [260]int8
}
type
  PROPPRG = packed record
    flPrg: Word;
    flPrgInit: Word;
    achTitle: array[0..29] of Shortint;
    achCmdLine: array[0..127] of Shortint;
    achWorkDir: array[0..63] of Shortint;
    wHotKey: Word;
    achIconFile: array[0..79] of Shortint;
    wIconIndex: Word;
    dwEnhModeFlags: DWORD;
    dwRealModeFlags: DWORD;
    achOtherFile: array[0..79] of Shortint;
    achPIFFile: array[0..259] of Shortint;
  end;
const PROPPRG = extern struct {
    flPrg: u16,
    flPrgInit: u16,
    achTitle: [30]i8,
    achCmdLine: [128]i8,
    achWorkDir: [64]i8,
    wHotKey: u16,
    achIconFile: [80]i8,
    wIconIndex: u16,
    dwEnhModeFlags: u32,
    dwRealModeFlags: u32,
    achOtherFile: [80]i8,
    achPIFFile: [260]i8,
};
type
  PROPPRG {.packed.} = object
    flPrg: uint16
    flPrgInit: uint16
    achTitle: array[30, int8]
    achCmdLine: array[128, int8]
    achWorkDir: array[64, int8]
    wHotKey: uint16
    achIconFile: array[80, int8]
    wIconIndex: uint16
    dwEnhModeFlags: uint32
    dwRealModeFlags: uint32
    achOtherFile: array[80, int8]
    achPIFFile: array[260, int8]
align(1)
struct PROPPRG
{
    ushort flPrg;
    ushort flPrgInit;
    byte[30] achTitle;
    byte[128] achCmdLine;
    byte[64] achWorkDir;
    ushort wHotKey;
    byte[80] achIconFile;
    ushort wIconIndex;
    uint dwEnhModeFlags;
    uint dwRealModeFlags;
    byte[80] achOtherFile;
    byte[260] achPIFFile;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PROPPRG サイズ: 658 バイト(x64)
dim st, 165    ; 4byte整数×165(構造体サイズ 658 / 4 切り上げ)
; flPrg : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; flPrgInit : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; achTitle : CHAR (+4, 30byte)  varptr(st)+4 を基点に操作(30byte:入れ子/配列)
; achCmdLine : CHAR (+34, 128byte)  varptr(st)+34 を基点に操作(128byte:入れ子/配列)
; achWorkDir : CHAR (+162, 64byte)  varptr(st)+162 を基点に操作(64byte:入れ子/配列)
; wHotKey : WORD (+226, 2byte)  wpoke st,226,値  /  値 = wpeek(st,226)
; achIconFile : CHAR (+228, 80byte)  varptr(st)+228 を基点に操作(80byte:入れ子/配列)
; wIconIndex : WORD (+308, 2byte)  wpoke st,308,値  /  値 = wpeek(st,308)
; dwEnhModeFlags : DWORD (+310, 4byte)  lpoke st,310,値  /  値 = lpeek(st,310)
; dwRealModeFlags : DWORD (+314, 4byte)  lpoke st,314,値  /  値 = lpeek(st,314)
; achOtherFile : CHAR (+318, 80byte)  varptr(st)+318 を基点に操作(80byte:入れ子/配列)
; achPIFFile : CHAR (+398, 260byte)  varptr(st)+398 を基点に操作(260byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PROPPRG, pack=1
    #field short flPrg
    #field short flPrgInit
    #field byte achTitle 30
    #field byte achCmdLine 128
    #field byte achWorkDir 64
    #field short wHotKey
    #field byte achIconFile 80
    #field short wIconIndex
    #field int dwEnhModeFlags
    #field int dwRealModeFlags
    #field byte achOtherFile 80
    #field byte achPIFFile 260
#endstruct

stdim st, PROPPRG        ; NSTRUCT 変数を確保
st->flPrg = 100
mes "flPrg=" + st->flPrg