The desktop management class is responsible for the window display, transfer window messaging, manages skin resources. The rough architecture is as follows: class cdesktop {addwindow (cgamewin * win); // Win is a pointer to the new window, inserts the chain head render (iDirectdrawsurface targetsurface; // targetsurface is rendering target loadskin (lpctstr szskin); // szskin is the skin The directory stored, automatically opened to: ./skin/ (SZSKIN )/*.* ...} The AddWindow function stores the winn pointer to a list in the class. Link list Maintains the window's pointer address, the order of the linked list Represents the Z axis of the window. The more brought the front, the more the window is in the top. In the Render method, render all windows to the target Surface. The rendering order begins from the tail of the chain table. Command messaging order begins with the chain head. The mouse message is passed to the window, and the window itself sears the control on the window in the same principle, and if not in the current window, continue the search for the next window. If you find a control, return to the control pointer, export the private variable of the Desktop class, represent the control of the current focus. CWIN and CCONTROL are derived from the COBJECT, and the COBject has a method getType returns the type string of the current class. CWIN, CBUTTON, CMENU, etc. Overload this function, returns "Window" "Button" "Menu" and other strings. Button messages can force conversions according to the type of current focus control, and then respond. For example, the CEDIT control is a text box, you can use an Execkey command to respond to the button command. If the target is the CButton control, the Enter key can call the click () process directly. Also pay attention to attributes such as Enabled, with reference to VB relative control properties. There is also an error that should be prevented from caught in consecutive clicking on such errors. At 4:20 in the early morning of the year, I will stay here. go to bed……