If anyone is familiar with this example from Petzold's Win95 book I'd appreciate some help. How would you code the following header file? Its an array of structures, with the second and third fields being pointers to strings.

/*-----------------------------------------------
   SYSMETS.H -- System metrics display structure
  -----------------------------------------------*/

#define NUMLINES ((int) (sizeof sysmetrics / sizeof sysmetrics [0]))

struct
{
int  iIndex ;
char *szLabel ;
char *szDesc ;
}
sysmetrics [] =
{
SM_CXSCREEN,          "SM_CXSCREEN",          "Screen width in pixels",
SM_CYSCREEN,          "SM_CYSCREEN",          "Screen height in pixels",
SM_CXVSCROLL,         "SM_CXVSCROLL",         "Vertical scroll arrow width",
SM_CYHSCROLL,         "SM_CYHSCROLL",         "Horizontal scroll arrow height",
SM_CYCAPTION,         "SM_CYCAPTION",         "Caption bar height",
SM_CXBORDER,          "SM_CXBORDER",          "Window border width",
SM_CYBORDER,          "SM_CYBORDER",          "Window border height",
SM_CXDLGFRAME,        "SM_CXDLGFRAME",        "Dialog window frame width",
SM_CYDLGFRAME,        "SM_CYDLGFRAME",        "Dialog window frame height",
SM_CYVTHUMB,          "SM_CYVTHUMB",          "Vertical scroll thumb height",
SM_CXHTHUMB,          "SM_CXHTHUMB",          "Horizontal scroll thumb width",
SM_CXICON,            "SM_CXICON",            "Icon width",
SM_CYICON,            "SM_CYICON",            "Icon height",
SM_CXCURSOR,          "SM_CXCURSOR",          "Cursor width",
SM_CYCURSOR,          "SM_CYCURSOR",          "Cursor height",
SM_CYMENU,            "SM_CYMENU",            "Menu bar height",
SM_CXFULLSCREEN,      "SM_CXFULLSCREEN",      "Full screen client area width",
SM_CYFULLSCREEN,      "SM_CYFULLSCREEN",      "Full screen client area height",
SM_CYKANJIWINDOW,     "SM_CYKANJIWINDOW",     "Kanji window height",
SM_MOUSEPRESENT,      "SM_MOUSEPRESENT",      "Mouse present flag",
SM_CYVSCROLL,         "SM_CYVSCROLL",         "Vertical scroll arrow height",
SM_CXHSCROLL,         "SM_CXHSCROLL",         "Horizontal scroll arrow width",
SM_DEBUG,             "SM_DEBUG",             "Debug version flag",
SM_SWAPBUTTON,        "SM_SWAPBUTTON",        "Mouse buttons swapped flag",
SM_RESERVED1,         "SM_RESERVED1",         "Reserved",
SM_RESERVED2,         "SM_RESERVED2",         "Reserved",
SM_RESERVED3,         "SM_RESERVED3",         "Reserved",
SM_RESERVED4,         "SM_RESERVED4",         "Reserved",
SM_CXMIN,             "SM_CXMIN",             "Minimum window width",
SM_CYMIN,             "SM_CYMIN",             "Minimum window height",
SM_CXSIZE,            "SM_CXSIZE",            "Minimize/Maximize icon width",
SM_CYSIZE,            "SM_CYSIZE",            "Minimize/Maximize icon height",
SM_CXFRAME,           "SM_CXFRAME",           "Window frame width",
SM_CYFRAME,           "SM_CYFRAME",           "Window frame height",
SM_CXMINTRACK,        "SM_CXMINTRACK",        "Minimum window tracking width",
SM_CYMINTRACK,        "SM_CYMINTRACK",        "Minimum window tracking height",
SM_CXDOUBLECLK,       "SM_CXDOUBLECLK",       "Double click x tolerance",
SM_CYDOUBLECLK,       "SM_CYDOUBLECLK",       "Double click y tolerance",
SM_CXICONSPACING,     "SM_CXICONSPACING",     "Horizontal icon spacing",
SM_CYICONSPACING,     "SM_CYICONSPACING",     "Vertical icon spacing",
SM_MENUDROPALIGNMENT, "SM_MENUDROPALIGNMENT", "Left or right menu drop",
SM_PENWINDOWS,        "SM_PENWINDOWS",        "Pen extensions installed",
SM_DBCSENABLED,       "SM_DBCSENABLED",       "Double-Byte Char Set enabled",
SM_CMOUSEBUTTONS,     "SM_CMOUSEBUTTONS",     "Number of mouse buttons",
SM_SHOWSOUNDS,        "SM_SHOWSOUNDS",        "Present sounds visually"
} ;
Posted on 2001-06-28 23:52:00 by AsmChasm
Maybe, this might work...

SysMet STRUCT
 iIndex dd ?
 szLabel dd ?
 szDesc dd ?
SysMet ENDS

sysmetrics SysMet {SM_CXSCREEN, OFFSET zSTR00a, OFFSET zSTR00b},
        {SM_CYSCREEN, OFFSET zSTR01a, OFFSET zSTR01b},
        {SM_CXVSCROLL, OFFSET zSTR02a, OFFSET zSTR02b}

; ...etc...

sysmetrics_end

zSTR00a db "SM_CXSCREEN",0
zSTR00b db "Screen width in pixels",0
zSTR01a db "SM_CYSCREEN",0
zSTR01b db "Screen height in pixels",0
zSTR02a db "SM_CXVSCROLL",0
zSTR02b db "Vertical scroll arrow width",0

; ...etc...

NUMLINES = (SIZEOF sysmetrics) / (TYPE sysmetrics)
Note: The sysmetrics data will exceed the line length and I think this messes up the 'SIZEOF' operator, so you'll need to solve this in another manner (change SIZEOF to sysmetrics_end - sysmetrics). Hope this helps. :) This message was edited by bitRAKE, on 6/29/2001 1:04:31 AM
Posted on 2001-06-29 01:03:00 by bitRAKE
AsmChasm, Ron Thomas has ported the sample in asm32: http://www.rbthomas.freeserve.co.uk/ hth vesa
Posted on 2001-06-29 09:35:00 by vesa