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.