| View previous topic :: View next topic |
| Author |
Message |
pj Newbie
Joined: 26 Apr 2002 Posts: 11
|
Posted: Thu Sep 15, 2005 2:32 pm Post subject: User32.dll and menu enable/disable |
|
|
I got this from msdn, and would like to be able to enable and disable close minimize maximize restore option on the system menu, as well as the window widgets of a non VDS app. I can't see to work out the syntax of combining MF_BYPOSITION and MF_ENABLED, MF_DISABLED, or MF_GRAYED.
| Code: | | %a =@lib(user32.dll,EnableMenuItem,INT:,%H,6,%%MF_BYPOSITION,%%MF_GRAYED) |
This does not seem to work.
Can anyone help?
Thanks
PJ
| Quote: |
EnableMenuItem Function
The EnableMenuItem function enables, disables, or grays the specified menu item.
Syntax
BOOL EnableMenuItem(
HMENU hMenu,
UINT uIDEnableItem,
UINT uEnable
);
Parameters
hMenu
[in] Handle to the menu.
uIDEnableItem
[in] 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, menu, or submenu.
uEnable
[in] Controls 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.
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 -1.
|
|
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Thu Sep 15, 2005 7:05 pm Post subject: |
|
|
Hi pj,
I am by no means an expert, but I tinker with this stuff on occasion.
Near as I can tell, to gray, by position, the command would go something like this:
| Code: | %a =@lib(user32.dll,EnableMenuItem,bool:,int:%H,int:6,int:1025)
|
I believe the last parameter must be translated into a representitive integer value. I found these values in winuser.h by doing a search of the mfc libraries for one of the parameters (MF_BYPOSITION). In there I found the hex value assignments. I then converted those to decimal, and added the parameters that I wanted (by pos & grayed). Let me know if this works...
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Thu Sep 15, 2005 7:42 pm Post subject: |
|
|
CodeScript also has many of these constants and their equivilent integer values in his api lookup tool. Search the main site's downloads for
'api' and look for a file by codescript. |
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Thu Sep 15, 2005 10:51 pm Post subject: |
|
|
Sounds cool... But where do we find the w32.hlp file it requires?
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Fri Sep 16, 2005 1:25 am Post subject: |
|
|
Also for future reference, you can do this:
| Code: |
%%MF_BYPOSITION = $0400
%%MF_GRAYED = $01
%a = @lib(user32.dll,EnableMenuItem,INT:,%H,6,@sum(%%MF_BYPOSITION,%%MF_GRAYED))
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri Sep 16, 2005 5:22 am Post subject: |
|
|
Hi All,
You do not need the Win32 API to enable/disable a menu item in VDS 5. Here is a quote from the VDS 5 help file about enabling and disabling menu controls
| Quote: |
The Registry values that control enabling or disabling of a menu item are placed in a subfolder named MenuCtrl. By default a menu item is enabled. The registry value should contain "X" to disable it.
Example:
REGISTRY WRITE, DEFAULT, MenuCtrl, Save As…, X {disable}
REGISTRY DELETE, DEFAULT, ,Save As… {re-enable}
|
_________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Fri Sep 16, 2005 8:43 pm Post subject: |
|
|
of a non VDS app
 |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sat Sep 17, 2005 3:23 pm Post subject: |
|
|
You can also hook a menu with SSMenu.Dll _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sat Sep 17, 2005 5:03 pm Post subject: |
|
|
| PGWARE wrote: | of a non VDS app
 |
Sorry I missed that part  _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|