Skip to content

Conversation

@Jack251970
Copy link
Contributor

@Jack251970 Jack251970 commented Nov 26, 2024

Removed Vanara.PInvoke.Shell32.CMF & Vanara.PInvokeVanara.PInvoke.RECT import.
Replaced Vanara.PInvoke.Shell32.IApplicationActivationManage with Windows.Win32.UI.Shell.IApplicationActivationManager.
Removed useless Vanara import.

For #15000

@0x5bfa 0x5bfa added the ready for review Pull requests that are ready for review label Nov 26, 2024
@0x5bfa
Copy link
Member

0x5bfa commented Nov 26, 2024

This looks great, thank you!

While you're at context menu thing, could you replace these manually defined types with cswin32 too?

// Same definition of Vanara.PInvoke.User32.MenuItemType
public enum MenuItemType : uint
{
MFT_STRING = 0,
MFT_BITMAP = 4,
MFT_MENUBARBREAK = 32,
MFT_MENUBREAK = 64,
MFT_OWNERDRAW = 256,
MFT_RADIOCHECK = 512,
MFT_SEPARATOR = 2048,
MFT_RIGHTORDER = 8192,
MFT_RIGHTJUSTIFY = 16384
}
public enum HBITMAP_HMENU : long
{
HBMMENU_CALLBACK = -1,
HBMMENU_MBAR_CLOSE = 5,
HBMMENU_MBAR_CLOSE_D = 6,
HBMMENU_MBAR_MINIMIZE = 3,
HBMMENU_MBAR_MINIMIZE_D = 7,
HBMMENU_MBAR_RESTORE = 2,
HBMMENU_POPUP_CLOSE = 8,
HBMMENU_POPUP_MAXIMIZE = 10,
HBMMENU_POPUP_MINIMIZE = 11,
HBMMENU_POPUP_RESTORE = 9,
HBMMENU_SYSTEM = 1
}

@Jack251970
Copy link
Contributor Author

This looks great, thank you!

While you're at context menu thing, could you replace these manually defined types with cswin32 too?

// Same definition of Vanara.PInvoke.User32.MenuItemType
public enum MenuItemType : uint
{
MFT_STRING = 0,
MFT_BITMAP = 4,
MFT_MENUBARBREAK = 32,
MFT_MENUBREAK = 64,
MFT_OWNERDRAW = 256,
MFT_RADIOCHECK = 512,
MFT_SEPARATOR = 2048,
MFT_RIGHTORDER = 8192,
MFT_RIGHTJUSTIFY = 16384
}
public enum HBITMAP_HMENU : long
{
HBMMENU_CALLBACK = -1,
HBMMENU_MBAR_CLOSE = 5,
HBMMENU_MBAR_CLOSE_D = 6,
HBMMENU_MBAR_MINIMIZE = 3,
HBMMENU_MBAR_MINIMIZE_D = 7,
HBMMENU_MBAR_RESTORE = 2,
HBMMENU_POPUP_CLOSE = 8,
HBMMENU_POPUP_MAXIMIZE = 10,
HBMMENU_POPUP_MINIMIZE = 11,
HBMMENU_POPUP_RESTORE = 9,
HBMMENU_SYSTEM = 1
}

I will check it later.

@Jack251970
Copy link
Contributor Author

@0x5bfa As for MFT_SEPARATOR flag, just write MFT_SEPARATOR in NativeMethods.txt cannot help.

As for HBITMAP_HMENU, it is only used for checking in !Enum.IsDefined(typeof(HBITMAP_HMENU), ((IntPtr)menuItemInfo.hbmpItem).ToInt64()).

@0x5bfa
Copy link
Member

0x5bfa commented Nov 26, 2024

Add MENU_ITEM_TYPE instead.

As for HBITMAP_HMENU, it is only used for checking in !Enum.IsDefined(typeof(HBITMAP_HMENU), ((IntPtr)menuItemInfo.hbmpItem).ToInt64()).

Maybe we should leave it as is.
Or you could add "HBMMENU_*" and make it work like before.

….Win32.UI.WindowsAndMessaging.MENU_ITEM_TYPE
@Jack251970
Copy link
Contributor Author

@0x5bfa Have found MENU_ITEM_TYPE and just keep HBITMAP_HMENU.

Copy link
Member

@0x5bfa 0x5bfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much!

@yaira2 yaira2 added ready to merge Pull requests that are approved and ready to merge and removed ready for review Pull requests that are ready for review labels Nov 26, 2024
@yaira2 yaira2 merged commit 20ef76a into files-community:main Nov 26, 2024
6 checks passed
@yaira2
Copy link
Member

yaira2 commented Nov 26, 2024

@Jack251970 thank you!

@Jack251970 Jack251970 deleted the dev1 branch February 6, 2025 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge Pull requests that are approved and ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants