Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

User32: make MENUITEMINFO.Create() static #458

Closed
x1unix opened this issue Jun 14, 2020 · 1 comment · Fixed by #460
Closed

User32: make MENUITEMINFO.Create() static #458

x1unix opened this issue Jun 14, 2020 · 1 comment · Fixed by #460
Assignees
Labels

Comments

@x1unix
Copy link

x1unix commented Jun 14, 2020

Hello, currently MENUITEMINFO.Create() is instance method and if I need to create the struct with correct size, I need to do this:

MENUITEMINFO mii = new MENUITEMINFO();
MENUITEMINFO correctMii = mii.Create();

Currently, I don't see any advantage of non-static .Create() because it doesn't utilize original struct's state:

 public MENUITEMINFO Create()
            {
                return new MENUITEMINFO
                {
                    cbSize = Marshal.SizeOf(typeof(MENUITEMINFO))
                };
            }

I think that it will be more convenient to make this method static to avoid mii declaration (or provide alternative way to initialize the struct):

MENUITEMINFO mii = MENUITEMINFO.Create();
@AArnott
Copy link
Collaborator

AArnott commented Jun 14, 2020

Ya, that's a bug in the API.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants