⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 microwindows_architecture.html

📁 Nano-x的设计架及相关文档----这是网上下载的中文翻译版本, E文的可以在其网站上下载.
💻 HTML
📖 第 1 页 / 共 5 页
字号:
&nbsp;&nbsp;&nbsp; CreateWindowEx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Createan instance of a window of a certain class<br>&nbsp;&nbsp;&nbsp;DestroyWindow&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Destroy awindow instance</p><p>The WM_CREATE message is just after window creation, before returning fromCreateWindowEx.&nbsp; The WM_DESTROY message is sent just before destroying a window withDestroyWindow. </p><p>When a window is registered, extra bytes can be allocated to the window structure whencreated.&nbsp; The GetWindowLong, GetWindowWord, SetWindowLong and SetWindowWordmanipulate these bytes.&nbsp; In addition, a fixed number of extra bytes per window classcan be allocated on registration and retrieved via the GetClassLong function.</p><h3>&nbsp;&nbsp;&nbsp; 3.3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Window showing,hiding and moving</h3><p>The ShowWindow function allows windows to be made visible or hidden.&nbsp; In addition,this can be specified during the creation of the window, through CreateWindowEx.&nbsp;MoveWindow is called to change a window's position or size.&nbsp; A WM_MOVE message issent if the window's position changes, and WM_SIZE is sent on size changes.</p><h3>&nbsp;&nbsp;&nbsp; 3.4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Window painting</h3><p>The Microwindows system determines when a window needs to be initially painted orrepainted as the result of other window movement, and a WM_PAINT message is sent to theassociated window procedure.&nbsp; At this point, it's up the the application to use thegraphics primitives available to paint the window, described below.&nbsp; Microwindowskeeps track of a windows' &quot;update&quot; region, and sends WM_PAINT whenever theregion is non-empty.&nbsp; For speed reasons, the WM_PAINT message is only sent when thereare no other messages in the application's queue.&nbsp; This allows the application torepaint in one, rather than possibly many, steps.&nbsp; To force a repaint rather thanwaiting, the UpdateWindow function can be called.&nbsp; The InvalidateRect functionspecifies a rectangle to add to the update region, causing a subsequent WM_PAINT.</p><p>The window title is automatically painted and is set with the SetWindowText function,and retrieved with the GetWindowText function.</p><h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.4.1&nbsp;&nbsp;&nbsp; Client and screencoordinates</h3><p>Every window is drawn on the screen using the device global screen coordinate systemfor absolute reference to any pixel on the screen.&nbsp; The Microwindows API allowsapplications programmers to be concerned with only the relative coordinates from the upperleft portion of their window, not including the title bar and 3d effects.&nbsp; Thiscoordinate system is called &quot;client coordinates.&quot;&nbsp; As will be explainedbelow, the Microwindows programmer has the option of getting a device context in eitherscreen or client coordinates.&nbsp; If device coordinates are specified, then thecoordinate system is device-based and includes the title area and 3d areas of thewindow.&nbsp; Otherwise, the drawable region is clipped to just that&nbsp; area that isreserved by the system for the application's drawing.&nbsp; The GetClientRect andGetWindowRect functions return client or screen coordinates for the passed window.&nbsp;ClientToScreen and ScreenToClient can be called to translate between window coordinatesystems.</p><h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.4.2&nbsp;&nbsp;&nbsp; Device contexts</h3><p>An applications programmer must obtain a &quot;device context&quot; before calling anygraphics drawing API functions.&nbsp; As explained above, this specifies to the systemwhich window and what coordinate system are desired, so that these don't have to be passedto every graphics function.&nbsp; In addition, various other attributes like foregroundand background color are also set in a device context, so that these parameters don't haveto be specified for every graphics operation.&nbsp; The device context selects theappropriate clipping region based on the window specified and the coordinate system.&nbsp;When a device context is obtained, various graphics values are set to default values.</p><p>To obtain a client device context, call GetDC.&nbsp; To obtain a screen device context,required when drawing onto title bars and the like, call GetWindowDC.&nbsp; In addition,fancy clipping operations and child/sibling window clipping can be specified if GetDCEx iscalled.&nbsp; When finished drawing, the ReleaseDC function must be called to deallocatethe DC.</p><p>On receipt of the WM_PAINT message, two special calls, BeginPaint and EndPaint arecalled, that serve as replacements to the GetDC/ReleaseDC functions.&nbsp; These functionsessentially allocate a DC but also validate the update region so that no subsequentWM_PAINT messages are generated.&nbsp; BeginPaint also combines the update region and theclipping region so that user output will only occur where previously invalidated.</p><h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.4.3&nbsp;&nbsp;&nbsp; Graphics drawingAPI</h3><p>There are many graphics drawing API's in the Microwindows API.&nbsp; Following is alist, most of these match up to the engine GdXXX functions discussed in section 2.</p><p>&nbsp;&nbsp;&nbsp;SetTextColor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the foreground text color in a DC<br>&nbsp;&nbsp;&nbsp;SetBkColor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the background color in a DC<br>&nbsp;&nbsp;&nbsp;GetSysColor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the system color defined for the current look and feel scheme<br>&nbsp;&nbsp;&nbsp;SetBkMode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the use background flag in a DC<br>&nbsp;&nbsp;&nbsp;SetROP2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the drawing mode (XOR, SET, etc) for drawing<br>&nbsp;&nbsp;&nbsp;SetPixel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Draw a pixel in the current fg color<br>&nbsp;&nbsp;&nbsp;MoveToEx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Prepare to draw a line<br>&nbsp;&nbsp;&nbsp;LineTo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Draw a line from the last location to this one in the current fg color<br>&nbsp;&nbsp;&nbsp;Rectangle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Draw a rectangle in the current pen color<br>&nbsp;&nbsp;&nbsp;FillRect&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fill a rectangle with the current brush color<br>&nbsp;&nbsp;&nbsp;TextOut&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Draw text in the current fg/bg color<br>&nbsp;&nbsp;&nbsp;ExtTextOut&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Draw text in the current fg/bg color<br>&nbsp;&nbsp;&nbsp;DrawText&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Draw text or compute text height and width sizes<br>&nbsp;&nbsp;&nbsp;DrawDIB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Draw a color bitmap<br>&nbsp;&nbsp;&nbsp;SelectObject&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Select a pen, brush or font to use in a DC<br>&nbsp;&nbsp;&nbsp;GetStockObject&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get a predefined standard pen, brush or font<br>&nbsp;&nbsp;&nbsp;CreatePen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a pen of a certain color<br>&nbsp;&nbsp;&nbsp;CreateSolidBrush&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a brush of a certain color<br>&nbsp;&nbsp;&nbsp; CreateCompatibleBitmap&nbsp; Create an offscreen area to draw onto<br>&nbsp;&nbsp;&nbsp;DeleteObject&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Delete a pen, brush or bitmap<br>&nbsp;&nbsp;&nbsp; CreateCompatibleDC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Create anoffscreen DC<br>&nbsp;&nbsp;&nbsp;DeleteDC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Delete an offscreen DC<br>&nbsp;&nbsp;&nbsp;BitBlit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copy from one bitmap in a DC to another<br>&nbsp;&nbsp;&nbsp; GetSystemPaletteEntries&nbsp;&nbsp;&nbsp; Get the currently in-usesystem palette entries<br>&nbsp;&nbsp; </p><h3>&nbsp;&nbsp;&nbsp; 3.5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Utility functions</h3><p>A number of routines are provided for various purposes, described below.&nbsp; Inaddition, Microwindows currently exports some helper routines, named WndXXX, that areuseful but subject to change.&nbsp; These are detailed following:</p><p>&nbsp;&nbsp;&nbsp;WndSetDesktopWallpaper&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the desktop background image<br>&nbsp;&nbsp;&nbsp;WndSetCursor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the cursor for a window<br>&nbsp;&nbsp;&nbsp;WndRaiseWindow&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Raise a window's z-order<br>&nbsp;&nbsp;&nbsp;WndLowerWindow&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lower a window's z-order<br>&nbsp;&nbsp;&nbsp;WndGetTopWindow&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return the topmost window's handle<br>&nbsp;&nbsp;&nbsp;WndRegisterFdInput&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Register to send a message when file descriptor has read data available<br>&nbsp;&nbsp;&nbsp;WndUnregisterFdInput&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unregister file descriptor for read data messages</p><p>&nbsp;&nbsp;&nbsp;GetTickCount&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return # milliseconds elapsed since startup<br>&nbsp;&nbsp;&nbsp;Sleep&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Delay processing for specified milliseconds</p><h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.5.1&nbsp;&nbsp;&nbsp; Setting windowfocus</h3><p>The SetFocus routine is used to pass keyboard focus from one window to another.&nbsp;Keystrokes are always sent to the window with focus.&nbsp; The WM_SETFOCUS andWM_KILLFOCUS messages are sent to windows just receiving and losing focus.&nbsp; TheGetActiveWindow routines returns the first non-child ancestor of the focus window, whichis the window that is currently highlighted.&nbsp; The GetDesktopWindow routine returnsthe window handle of the desktop window.</p><h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.5.2&nbsp;&nbsp;&nbsp; Mouse capture</h3><p>Normally, Microwindows sends WM_MOUSEMOVE messages to the window the mouse is currently

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -