Log in

View Full Version : newbie here, trying to disable menuitem


oVum
February 15th, 2004, 10:45
hi

The way I try'd was to change the byte 2 before the string i wanted to gray out with 01 ,I opened the menu and it looked to have worked but opening it a second time the menuitem was active again,the same thing was happening using a resource editor,The EnableMenuItem API is new to me but i think it is only way i can succeed can anyone help me how to do it that way it would be much appreciated

naides
February 15th, 2004, 12:45
Quote:
[Originally Posted by oVum]hi

The way I try'd was to change the byte 2 before the string i wanted to gray out with 01 ,I opened the menu and it looked to have worked but opening it a second time the menuitem was active again,the same thing was happening using a resource editor,The EnableMenuItem API is new to me but i think it is only way i can succeed can anyone help me how to do it that way it would be much appreciated


Read the tutorials on grayed menus, which are plenty in the links below. Clandestiny's is one of my favorites, and he refers you to others in there. also look in www.anticrack.de for grayed option tutorials and you will have plenty of introductory material.

Also look up 'EnableMenuItem' in an API reference or directly in google, and you will have some info about its parameters, and how it gets called.

Be aware that if your app uses MFC or other frameworks things can be a little more involved.

Without more details this is all I can tell you.

oVum
February 19th, 2004, 02:19
I'm sorry to say after reading essays by Clandestiny Lord Soth and others i'm still no closer to solving :\
naides can u chk your pm plz

regards
oVum

evlncrn8
February 19th, 2004, 03:13
Quote:
[Originally Posted by oVum]I'm sorry to say after reading essays by Clandestiny Lord Soth and others i'm still no closer to solving :\
naides can u chk your pm plz

regards
oVum


The EnableMenuItem function enables, disables, or grays the given menu item.

BOOL EnableMenuItem(

HMENU hMenu, // handle of menu
UINT uIDEnableItem, // menu item to enable, disable, or gray
UINT uEnable // menu item flags
);
Parameters

hMenu

Identifies the menu.

uIDEnableItem

Specifies the menu item to be enabled, disabled, or grayed, as determined by the uEnable parameter. This parameter specifies an item in a menu bar or in a pop-up menu.

uEnable

Specifies flags that control the interpretation of the uIDEnableItem parameter and indicate whether the menu item is enabled, disabled, or grayed. This parameter must be a combination of either MF_BYCOMMAND or MF_BYPOSITION and MF_ENABLED, MF_DISABLED, or MF_GRAYED.

Value Meaning
MF_BYCOMMAND Indicates that uIDEnableItem gives the identifier of the menu item. If neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified, the MF_BYCOMMAND flag is the default flag.
MF_BYPOSITION Indicates that uIDEnableItem gives the zero-based relative position of the menu item.
MF_DISABLED Indicates that the menu item is disabled, but not grayed, so it cannot be selected.
MF_ENABLED Indicates that the menu item is enabled and restored from a grayed state so that it can be selected.
MF_GRAYED Indicates that the menu item is disabled and grayed so that it cannot be selected.
Return Value

The return value specifies the previous state of the menu item (it is either MF_DISABLED, MF_ENABLED, or MF_GRAYED). If the menu item does not exist, the return value is 0xFFFFFFFF.

Remarks

An application must use the MF_BYPOSITION flag to specify the correct menu handle. If the menu handle of the menu bar is specified, the top-level menu item (an item in the menu bar) is affected. To set the state of an item in a pop-up or nested pop-up menu by position, an application must specify the handle of the pop-up menu.
When an application specifies the MF_BYCOMMAND flag, Windows checks all pop-up items that are subordinate to the menu identified by the specified menu handle. Therefore, unless duplicate menu items are present, specifying the menu handle of the menu bar is sufficient.

sLayer
February 20th, 2004, 02:40
OK now go to imports and in double click "Enable Menu Item".
Then u must see two jumps above it.
LIke this
First Comes the
Crap "je"<----Change this
Crap "Jne"
It should be in this format.Go and change the "Je" only to "Jne"
U can disable the menu.
IF the enable menu item function occurs many times trace until u find
this code.
Another way is through the hex way.
I used Heedit 2.1.14
Open the file
Lets suppose the menu is "Register".
Scroll down in heedit till u see someting like this.
R.e.g.i.s.t.e.r.This mostly occurs in the bottom section.
Now look for a "P" up there its value in hex should be "50"
Change the 50 to 58.Then then the menu is completely disabled.
If u put a "00" then the menu dissappears.
Hope this will help

Laterz