Solved

Need Visual Basic Declare for API GetMenuString

Posted on 1998-03-21
1
715 Views
Last Modified: 2013-11-25
     This is a question involving windows programming and
Access Basic. I'm not sure which section is most suited
to answering it, so I've posted to both.(NOW 3 PLACES) I need the capability
to disable custom menu items at runtime. I would like to be able
to access the items by their 'names'. That is, to disable the
'copy' command, I would like to refer to that command using the
argument 'copy'. I'm attempting to write a routine for this purpose
in Access Basic, (version 2.0). Access does not provide an
in built method for doing this. So, I attempted to use the API
function GetMenuString to retrieve the menu item 'names'. On
their website, Microsoft has kindly provided the C prototype
for GetMenuString. I tried to adapt this to Access, but
ran into problems. I can find no indication that Microsoft
provides a Visual Basic equivalent of the C prototype on their site.



The difference between the C GetMenuString and the Access
GetMenuString may have something to do with the way C
implements a string. C uses an array thusly: MyString(10) to
indicate a string of 9 characters. String length in Access
is usually not specified. So what I'm asking for is the
proper way of declaring the API GetMenuString for use with
Access. If there's a better way of getting what I want done,
though, I'd of course be interested.

      On the basis that the answer to this question will be one line
long, (that is just the proper calling convention for GetMenuString),
I'm assigning  an initial 100 points to this question. If things get
more complicated, I'll review accordingly.

Windows 3.1, Access Basic 2.0 -

NOTE: C source files are not available to me.


POSTED TO WINDOWS PROGRAMMING AND ACCESS BASIC, AND
VISUAL BASIC
0
Comment
Question by:philc
[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
1 Comment
 
LVL 1

Accepted Solution

by:
stevesm earned 100 total points
ID: 1459549
Declare Function GetmenuString& Lib "user32" Alias "GetMenuStringA" (ByVal) hMenu As long, By Val wIDItem As Long, ByVal 1pString As String, ByVal nMaxCount As Long, ByVal wFlag As Long)

Parameter=nMaxCount Type/Description=Long-The maximum number of characters to load into 1pString +1
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Suggested Courses
Course of the Month5 days, 16 hours left to enroll

627 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