Solved

Disabling a Menu item - Notepad for example

Posted on 2003-12-03
7
250 Views
Last Modified: 2010-05-01
Hi Guys,

  How do I enable/disable a menu item using API?

  For example, I open Notepad application, run my program,
and then when I click the File menu (of Notepad), the New menu item is disabled.

  Is that possible?  
  Thanks!

wuttrain
0
Comment
Question by:wuttrain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 2

Expert Comment

by:devoted2christ
ID: 9867989
I think that would depend a lot on the program. Some programs control their menu by populating it from registry values, while others store the information internally (just create a VB6 app with a menu and you'll see what I'm talking about). If it's just one program you're trying to do this to, then it may be possible, but for the most part it's going to be a very difficult chore...
0
 
LVL 2

Author Comment

by:wuttrain
ID: 9869328
devoted2christ,

thanks for the comments.  but i think i got the code i needed.

  lHwnd = GetHWND("Point -*", "*", "Send Menu Command - Import")
  hMainMenu = GetMenu(lHwnd)
  hMenu = GetSubMenu(hMainMenu, 0) 'get into the File Menu 0
 
  lRet = ModifyMenu(hMainMenu, 6, MF_BYPOSITION Or MF_GRAYED, 2, "&Lenders")
0
 
LVL 1

Expert Comment

by:GenericUserName
ID: 9869806
Oh, ok cool; I didn't know that. You can post a question in Community Support to get your points refunded.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Expert Comment

by:leonstryker
ID: 10212392
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/Refund
 
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

leonstryker
EE Cleanup Volunteer
0
 
LVL 2

Author Comment

by:wuttrain
ID: 10217724
leonstryker,

  I would like to have a refund for this question.  What should I do?

  Thanks!
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 10218052
Please post to the Community Support area.

Leon
0
 

Accepted Solution

by:
SpazMODic earned 0 total points
ID: 10266407
PAQed, with points refunded (125)

SpazMODic
EE Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question