This documentation is archived and is not being maintained.

StructMemberAlignment Property

Visual Studio .NET 2003

Specifies 1, 2, 4, 8, or 16-byte boundaries for struct member alignment. Exposes the functionality of the C++ compiler's /Zp option, and the MIDL compiler's /Zp option.

[Visual Basic .NET]
Public Property StructMemberAlignment() As structMemberAlignOption
[Visual Basic 6]
Property Get StructMemberAlignment() As structMemberAlignOption
Property Let StructMemberAlignment( _
   ByVal NewValue As structMemberAlignOption _
HRESULT __stdcall get_StructMemberAlignment(
   /* [out, retval] */ structMemberAlignOption* retVal
HRESULT __stdcall put_StructMemberAlignment(
   /* [in] */ structMemberAlignOption NewValue
public structMemberAlignOption StructMemberAlignment {get; set;}
[JScript .NET]
public function get StructMemberAlignment() : structMemberAlignOption
public function set StructMemberAlignment(
   NewValue : structMemberAlignOption


Use the structMemberAlignOption enumeration to change the value of the VCCLCompilerTool property.

Use midlStructMemberAlignOption to change the value of the VCMidlTool property.

The MIDL tool doesn't allow 16 byte boundaries.


The following sample code modifies the compiler's StructMemberAlignment property in the development environment:

' add reference to Microsoft.VisualStudio.VCProjectEngine
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module1
    Sub Test()
        Dim prj As VCProject
        Dim cfgs, tools As IVCCollection
        Dim cfg As VCConfiguration
        Dim tool As VCCLCompilerTool
        prj = DTE.Solution.Projects.Item(1).Object
        cfgs = prj.Configurations
        cfg = cfgs.Item(1)
        tool = cfg.Tools("VCCLCompilerTool")
        tool.StructMemberAlignment = structMemberAlignOption.alignSixteenBytes
    End Sub
End Module

See Samples for Project Model Extensibility for information on how to compile and run this sample.

See Also

Applies To: VCCLCompilerTool Object | VCMidlTool Object