I have menu in my resource file, but I want for parts of menu (popups) to be visible and accessible only if user is allowed to see (or for example, if the variable is true). How to do it?
Thanks for all help!
I have menu in my resource file, but I want for parts of menu (popups) to be visible and accessible only if user is allowed to see (or for example, if the variable is true). How to do it?
Thanks for all help!
[C++]
IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
2nd compiler: g++ (GCC 3.4.3/4.0.0)
3rd compiler: Borland 5.5
[C#]
IDE: Microsoft Visual C# Express 2005
2nd IDE: SharpDevelop
2nd compiler: csc in Command Prompt
.NET Framework: 2.0
[PHP]
Core: 5.1.0 beta 3
IDE: PHPEdit
2nd IDE: Notepad
Favourite extensions: exif,gd2,mysql
Favourite PEAR packages: DB, XML_RSS, ID3
Favourite databases: SQLite, MySQL
You can use the following functions to hide and show windows:
Code:ShowWindow(hwnd,SW_SHOW); // show a window ShowWindow(hwnd,SW_HIDE); // hide a window
I used EnableMenu(), ModifyMenu() and DeleteMenu() to do this.
Hooked a function to the dlgs init / create. Created the menu in full in the resource editor. Sent in the users access level and removed menu items based on that.
Watch the by_position flag as an items position changes as you add / remove items.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
Thanks - i made it work like this..:
Code:HMENU hMenu = GetMenu(hwnd); EnableMenuItem(hMenu, (UINT)MAKEINTRESOURCE(IDC_RESOURCE), MF_DISABLED | MF_GRAYED);
[C++]
IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
2nd compiler: g++ (GCC 3.4.3/4.0.0)
3rd compiler: Borland 5.5
[C#]
IDE: Microsoft Visual C# Express 2005
2nd IDE: SharpDevelop
2nd compiler: csc in Command Prompt
.NET Framework: 2.0
[PHP]
Core: 5.1.0 beta 3
IDE: PHPEdit
2nd IDE: Notepad
Favourite extensions: exif,gd2,mysql
Favourite PEAR packages: DB, XML_RSS, ID3
Favourite databases: SQLite, MySQL
You may also be interested in the WM_MENUSELECT notification. This is posted when a menu is selected, enabling you to grey out menu items as needed.