Announcement

Collapse
No announcement yet.

As Size

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • As Size

    Somehow I managed never to run across "As Size" and "As APISize", where both are declared as DWords, like this.

    Code:
    Type Size Dword
       cx As Long   ' LONG cx
       cy As Long   ' LONG cy
    End Type
    Type APISIZE Dword
       cx As Long   ' LONG cx
       cy As Long   ' LONG cy
    End Type
    Does anyone use these, and why?

  • #2
    I found the type definitions in WinDef.inc, but no functions/subs that used them. Searching on "size" hit almost all includes.

    They are not DWORDs. The members are LONG. A variable as type size is aligned in memory on a dword boundry.

    Cheers,
    Dale

    Comment


    • #3
      Also known as Sizel, used with for example GetTextExtentPoint32. Only used the Sizel "version". Never seen them declared Dword - is that from José's includes? From PBWin10, WinDef.inc:
      Code:
      TYPE SIZEL
          SIZE
      END TYPE

      Comment


      • #4
        Yep, from Jose's includes.

        Comment


        • #5
          So, the DWord in "Type Size DWord" is the directions to the compiler to align on a DWord boundary? I've heard of that being done, but never paid attention to how to make it happen, nor under which circumstances the requirement should be applied.

          ... added ... yep, I see that now in Help (the directions for alignment).

          ... added ... yep, I guess it's time (again) to read Help from front to back and see what else I've missed!

          Comment


          • #6
            Examples of Structure Alignment

            Importance of alignment even on x86 machines, part 1
            Importance of alignment even on x86 machines, part 2

            What structure packing do the Windows SDK header files expect?

            Type aligment well defined, one more reason to say thank to José...

            Comment


            • #7
              Kind of problems one may have with improper alignment...

              About aligmnent from José...

              Comment

              Working...
              X