I was recently assembling an old project of me (with an older windows.inc) and it gave an error about TBBUTTON. In windows.inc v1.23 TBBUTTON is defined as:

TBBUTTON STRUCT
  iBitmap           DWORD      ?
  idCommand         DWORD      ?
  fsState           BYTE       ?
  fsStyle           BYTE       ?
  _wPad1            WORD       ?
  dwData            DWORD      ?
  iString           DWORD      ?
TBBUTTON ENDS
While according to msdn, it should be:

typedef struct _TBBUTTON {
    int iBitmap; 
    int idCommand; 
    BYTE fsState; 
    BYTE fsStyle; 
    DWORD dwData; 
    INT_PTR iString; 
} TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON; 
Is the padding a bug or is the structure in windows.inc correct? Thomas
Posted on 2001-02-04 07:12:00 by Thomas
It's correct. The DWORD struct elements want to be on addresses evenly divisible by 4. Since the 2 byte params knock this off, an extra 2 bytes in the form of _Pad was stuck in there. It's a common way to force alignment inside a struct. _Pad is never used.
Posted on 2001-02-04 11:50:00 by Ernie