Solved

Need Visual Basic Declare for API GetMenuString

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

777 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