Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Need Visual Basic Declare for API GetMenuString

Posted on 1998-03-21
1
Medium Priority
?
743 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 400 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…

783 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