Solved

Win API "EnableMenuItem"

Posted on 1998-09-17
1
776 Views
Last Modified: 2008-02-01
I want to use "EnableMenuItem" to disable(grey) the CLOSE button on the top right corner of pkzip window. I tried "EnableMenuItem(lhMenu,6,MF_GRAYED And MF_BYPOSITION)", and nothing was disabled. In the command above, lhMenu is the menu handle,6 is position of CLOSE. Thanks for your help.
0
Comment
Question by:luming
1 Comment
 

Accepted Solution

by:
purushotham earned 80 total points
ID: 1435436
dear luming,
the usage of your api correct but instead of  "and" in between MF_GRAYED and  MF_BYPOSITION  you should use "or".

You should use like this

EnableMenuItem(lhMenu,6,MF_GRAYED or  MF_BYPOSITION)"

here i have an example using word applicaton for that you to first set the references in vb for microsoft word 8.0 object library and then use this code it might be helpfull to you
place a command button on form and paste the code under it
 Dim x As Object
Dim ret As Long
Dim ret1 As Long
Set x = CreateObject("word.application")
x.Application.documents.Add
x.Visible = True
ret1 = FindWindow("OpusApp", 0)
ret = EnableMenuItem(GetSystemMenu(ret1, False), 6, MF_GRAYED Or MF_BYPOSITION)

i don't know your exact usage if you can give me actual requirement i can give you code for that.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Updates not working for MS Windows 7 12 182
VB6 ListBox Question 4 49
MS Access 03, TransferText, decimal places 8 78
Fastest way to find and count same items VB6 16 26
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

831 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