Disable Lister menu item

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
AkulaBig
Senior Member
Senior Member
Posts: 372
Joined: 2021-09-09, 17:28 UTC

Disable Lister menu item

Post by *AkulaBig »

I want to disable the menu item in the plugin.
For the Total Commander menu, any option works:
HWND hTCHandle = FindWindowEx(0, 0, L"TTOTAL_CMD", 0);
1. EnableMenuItem(GetSubMenu(GetMenu(hTCHandle), 0), 0, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
2. EnableMenuItem(GetSubMenu(GetMenu(hTCHandle), 0), 502, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
3. EnableMenuItem(GetMenu(hTCHandle), 502, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
Naturally, the most correct option is 3.

For the Lister menu, command numbers are unknown. Therefore, I try to disable it using option 1:
HWND hLstHandle = FindWindowEx(0, 0, L"TLister", 0);
1. EnableMenuItem(GetSubMenu(GetMenu(hLstHandle), 0), 0, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
MF_DISABLED works. MF_GRAYED does not work. The menu item does not become gray.
How to solve this problem? And does the Lister menu have command numbers? To do option 3.
Post Reply