Solved

Win API "EnableMenuItem"

Posted on 1998-09-17
1
738 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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 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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now