The information in this article applies to:
SUMMARY
MenuTemp.exe is a sample program in that demonstrates how to use the
MENUITEMTEMPLATE structure and the LoadMenuIndirect() function.
Single-item arrays, such as mtString, provide a named field to use to
access memory. The actual text of the string is stored in the structure,
not a pointer to text stored elsewhere.
MORE INFORMATIONThe following files are available for download from the Microsoft
Download Center. Click the file names below to download the files: http://www.microsoft.com/downloads/search.aspand then click How to use the Microsoft Download Center. The declaration of MENUITEMTEMPLATE in WINDOWS.H from the Windows SDK version 3.1 is correct. If a program attempts to assign an LPSTR to mtString, the C compiler generates an error. Listed below is an erroneous code sample:
The mtString field is a 1-byte placeholder for the array. Because a LPSTR
is 4 bytes long, it cannot be assigned to a 1-byte quantity.
The mtString[1] declaration in the structure serves as a placeholder for an arbitrary number of characters. An application that uses the MENUITEMTEMPLATE structure must allocate memory both for the template itself and the string that is copied into mtString. The following code sample demonstrates how an application might create a MENUITEMTEMPLATE structure for a checked menu item having an ID value of 100 and "&Menuitem" as its text:
Additional query words:
Keywords : kbfile kbsample kbdocerr kb16bitonly kbMenu kbGrpUser kbWinOS310 kbWinOS300 |
Last Reviewed: December 7, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |