<p>I am developing a TCP/IP client that has to deal with a proprietary binary protocol. I was considering using user-defined types to represent the protocol headers, and using CopyMemory to shuffle data to and from the UDT and a byte array. However, it appears that VB6 adds padding bytes to align user-defined types. Is there any way to force VB6 to not pad UDT's, similar to the <code>#pragma pack</code> directive available in many C/C++ compilers? Perhaps a special switch passed to the compiler?</p>

No.
Your best bet is to write the low level code in C or C++ (where you do have
```
#pragma pack
```
), then expose the interface via COM.