Design Reading Notes for Windows-menus and other resources.

Source: Internet
Author: User

I. Identification of initial characters in Windows # Starting with ASCII data

 

Ii. Use of custom resources: I feel useless and will not write it down.

// Loadresource findresource lockresource

Note:

Hrsrc findresource (hmoduleHmodule,// Module handleLpctstrLpname,// Resource NameLpctstrLptype// Resource Type);

ForLpctstrLpnameIf "annabellee" is written in the resource ID, text ("annabellee") is used directly here. If no double quotation marks are used in the resource, it is normal: idr_annablelee, makeintresource (idr_annablelee) is used here );

 

Example of reading text resources (Text resource. txt file:

 

hResource = LoadResource (hInst,                      FindResource (hInst, TEXT ("AnnabelLee"),                                           TEXT ("TEXT"))) ;                    pText = (char *) LockResource (hResource) ;          iNumLines = 0 ;                    while (*pText != '\\' && *pText != '\0')          {               if (*pText == '\n')                    iNumLines ++ ;               pText = AnsiNext (pText) ;          }          *pText = '\0' ;

 

 

Iii. Menu

When you select a menu, several messages are generated. Generally, these messages do not need to be processed and are directly sent to defwindowproc.

Wm_initmenu

Wm_menuselect

Wm_initmenupopup

Wm_command

Wm_syscommand -- System menu. Maximize, minimize, and so on

Wm_menuchar -- Non-hotkey --- by default, it is triggered by defwindowproc.

 

Right-click to bring up the floating menu:

Initialization: loadmenu

Right-click event: trackpopupmenu

 

Custom System Menu:

    Hmenu getsystemmenu (hwndHwnd,// Handle to windowBoolBrevert// Reset option);-- Obtain the system menu,Brevert is trueRestore the system menu to the original state

After obtaining the accesskey, perform general operations. Appendmenu, deletemenu, insertmenu, modifymenu, removemenu,

Enablemenuitem, em_getsel, F

Deletemenu Delete and clear

Removemenu deletion is not cleared

 

Other menu commands:

Force refresh drawmenubar, getsubmenu, getmenuitemcount, getmenuitemid,

Checnmenuitem, getmenustring, getmenustate, destroymenu

 

4. The acceleration key defines the acceleration item correspondence in the resource, and then loadaccelerators during initialization.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.