API Questions - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: API Questions (/showthread.php?tid=1918) |
RE: API Questions - a740g - 08-20-2023 (08-20-2023, 06:15 PM)Jack Wrote: with all due respect to a740g, I am not comfortable with the padding in MENUITEMINFO80 is correct. Quote:Len of MENUITEMINFO = 80Steve is correct. Without the padding it will be far less than 80 and crash. RE: API Questions - SMcNeill - 08-20-2023 (08-20-2023, 06:15 PM)Jack Wrote: with all due respect to a740g, I am not comfortable with the padding in MENUITEMINFOTYPE MENUITEMINFO AS _UNSIGNED LONG cbSize 4 AS _UNSIGNED LONG fMask 8 AS _UNSIGNED LONG fType 12 AS _UNSIGNED LONG fState 16 AS _UNSIGNED LONG wID 20 AS STRING * 4 __padding1 24 AS _UNSIGNED _OFFSET hSubMenu 32 AS _UNSIGNED _OFFSET hbmpChecked 40 AS _UNSIGNED _OFFSET hbmpUnchecked 48 AS _UNSIGNED _OFFSET dwItemData 56 AS _UNSIGNED _OFFSET dwTypeData ' str ptr 64 AS _UNSIGNED LONG cch 68 AS STRING * 4 __padding2 72 AS _UNSIGNED _OFFSET hbmpItem 80 END TYPE What's wrong with it? RE: API Questions - a740g - 08-20-2023 Also, all elements should be at the correct offset (including the padding). RE: API Questions - a740g - 08-20-2023 (08-20-2023, 05:47 PM)TerryRitchie Wrote:(08-20-2023, 12:01 AM)a740g Wrote: Here. This should work on 64-bit compilers. I actually use the caveman's method. At least that's what I call it. But it works. I've attached source files that you can use to figure out stuff like these. Note that the results will be different on 32-bit and 64-bit compilers. But you should be able to cover both cases using the QB64 $IF metacommand. RE: API Questions - SpriggsySpriggs - 08-20-2023 I find that using OFFSETOF in a header helps quite a bit with making sure each type member is the right size and in the right position. |