Solved

Need Visual Basic Declare for API GetMenuString

Posted on 1998-03-21
1
685 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
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
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…

828 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