Solved

Need Visual Basic Declare for API GetMenuString

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

746 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

15 Experts available now in Live!

Get 1:1 Help Now