Are the fields in MS-OFORMS in fmPosition swapped?

Daniel Seiler 0 Reputation points
2023-11-03T21:23:22.28+00:00

In MS-OFORMS, specifically https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-oforms/73c3866f-bbac-4f45-ba70-645fd046bfdf the fmPosition struct is described as "Top (4 bytes)", then "Left (4 bytes)", i.e. vertical offset, then horizontal offset.

This is inconsistent with real world data I have found, such as the example at https://analysistabs.com/vba-code/excel-projects/calculator-userform/ (Download https://analysistabs.com/wp-content/uploads/2022/06/Calculator-using-Excel-VBA.xlsm). In there is a frmCalculator design stream with cmdBtn7, cmdBtn8, cmdBtn9, which are visually on the same row (i.e. same distance to top), but the second value in the stream is identical for all.

It is also inconsistent with fmSize being width, then height, which would be horizontal, then vertical. Is it possible that the specification is mismatched with the product implementation here and should be updated?

Kind regards

Office Open Specifications
Office Open Specifications
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Open Specifications: Technical documents for protocols, computer languages, standards support, and data portability. The goal with Open Specifications is to help developers open new opportunities to interoperate with Windows, SQL, Office, and SharePoint.
119 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tom Jebo 1,906 Reputation points Microsoft Employee
    2023-11-07T16:37:43.0766667+00:00

    Hi @Daniel Seiler ,

    It looks like the assumption that "Top" is a vertical or Y axis measurement is incorrect. The fmPosition struct matches the Windows API POINT structure (x then y). For fmPosition, the correct interpretation is "Top" means horizontal and "Left" means vertical, i.e. "Top" means the position along the top (horizontal) edge of the bounding box and "Left" means the position along the left vertical side of the bounding box.

    Does that help to clarify the meaning?

    Best regards,
    Tom Jebo
    Microsoft Open Specifications Support