Windows Programming Review notes (total 77 questions)

Source: Internet
Author: User
Tags bmp image

Windows Programming Review notes (total 77 questions)

(Personal finishing, only do review with:D, reproduced annotated Source: http://blog.csdn.net/hcbbt/article/details/42706501)

Knowledge points
  1. What is the difference between a double-byte character set and a Unicode character set? What's wrong with double-byte character sets

    • The double-byte character set (DBCS) encoding is 0-255,DBCS that contains 1-byte code and 2-byte code, whereas Unicode is a unified 16-bit system, which allows for 65,536 characters to be represented. Each character in Unicode is 16-bit wide instead of 8-bit wide. In Unicode, 8-bit binary means that a numeric value is meaningless, while a 8-bit value is still processed in a double-byte character set.
    • A double-byte character set is not all characters represented by two bytes, which can cause additional programming problems, such as string length calculations. and processing a double-byte character set is very complex.
  2. What is wide character? What are Unicode characters? What is the difference between them?

    • The characters represented by multiple bytes are called wide characters, and C uses wchar_t to represent the wide character data type.
    • Unicode is only an implementation of wide character encoding, storing one character in 2 bytes
    • Unicode is one of the wide characters, and the wide character is not necessarily Unicode.
  3. Describes the role of _unicode, TCHAR.h header files.

    • _unicode is a string handler in a program segment that is treated as a wide string handler or as a regular string-handling function.
    • TCHAR.h provides a series of alternate names for standard library functions that take a string as a parameter. These generic function names can point to the Unicode version of the function or to a non-Unicode version, and the key to the implementation is to add the _unicode identifier to the compilation command.
  4. What is the role of the resource description file? What is the function of the resource compiler?

    • The role of a resource description file is to record the resources that the application or process uses.
    • The function of the resource editor is to generate resources based on the information provided by the templates in the RC file and compile them into the required binaries, so the modern resource compiler essentially unites the resource generator and compiler to facilitate the use of programmers.
    • Resource file and resource description file (. RC) the difference?
      • The resources used by the application or process are recorded in a file, which is called a resource description file.
      • In WIN32, resources are called objects, which can be divided into two categories: the body resources and the binary resources.
  5. Tell me about the conventions of the Hungarian naming convention, and what idioms to keep in mind?

    • There are two conventions for the Hungarian naming convention:
      1. Identifiers start with one or several lowercase letters, which represent the data type of the identifier;
      2. Mixed-case writing, so that identifiers have a certain meaning, easy to understand, enhance readability.
    • Customary usage:
    • When you name a struct variable, you can use the lowercase character sequence of the struct name as the head of the variable name, or use the entire structure name as the structure variable name.
  6. The
  7. Interprets the principle of the event driver and compares it to a procedural procedure.

    • Event driver
    • after initializing and creating the application window, other activities basically stop, performing an infinite loop, waiting for the user to enter the message. Once the user provides input to generate the event, Windows receives the message and analyzes it, directing the application to work according to importance. If the message and application are irrelevant or meaningless, they do not respond, and if a lot of events occur, they are queued for processing in the message queue.
    • Start-and-set variables, structure-Fill window class, Register window class, create application window, and display windows on-screen

        Enter the message loop and from the queue Get a Message <---------------------------v ^ Whether this message is Wm_q               UIT---non-----> |                     |             |               is a window function |               | is an application-defined message?----> process message->|           V No v | Terminates execution of the message by default---------------;  
    • Procedural procedures are performed in the order in which the programmer programmed the program, top-down, and single-execution process specifications. Windows program execution is the process by which applications communicate with the operating system to each other, and message events are closely related.

  8. What is dynamic linking? What is static linking? What is the suffix for a dynamic link library file?

    • Dynamic Link: Set up a dynamic link library to make the same part as long as a backup, the program executes to this function, to the dynamic link library to fetch.
    • Static linking: When a program calls a function, the machine code of the function is merged into the program itself during the linking process.
    • Dll
  9. Explain the window class structure name and window class variables, why fill in the window class terms? What is the role of registration?

    • Wndclas is a window class structure name in Windows that defines a common template for a class of windows, reflecting the common characteristics of Windows.
    • A window class variable is a store that is printed according to the window class structure entry.

    • The window class clauses are the records that the window co-writes, fills in the clauses, forms the initialization window class.

    • The role of the registration window class is to make the Windows operating system aware of this window class, to associate the Windows operating system with this window class so that the window class is under the control of the Windows operating system.
  10. Which function is used to create the window? How many parameters is it? Please explain each parameter?

    • WinMain function
    • 4 x
      Int WINAPI WinMain(     // 识别字__stdcall,(编译器)     HINSTANCE   hInstance,    // 当前实例的句柄     HINSTANCE   hPrevInstance,// 先前实例的句柄,已废     LPSTR   lpCmdLine,        // 命令行参数字符串    int  nShowCmd);             // 参数个数
  11. Where does the window class name in the application get from?

    • Szappname in the window class structure clause, the window class name in the normal application is the same as the application name.
  12. How is the main program WinMain and WndProc contacted?

    • wndclass.lpfnWndProc = WndProc ; // 窗口消息处理程序地址
    • The WinProc window handler is a callback function that is used to process messages that are called by Windows.
    • At the time of registering the window class, the entry address of the window handler function is specified, and the message received by the application is given to the window processing function of this portal address.
  13. Explain several functions in the message loop?

    • message loop with MSG structure:
      while (GetMessage (&msg, NULL, 0, 0)) { // 是否为 !WM_QUIT    TranslateMessage (&msg);            // 规范化    DispatchMessage (&msg);             // 调用}
  14. Interprets the System Global window class, applies the Global window class, and applies a dedicated window class.

    • The System Global window class is also known as the Pre-defined window class, and 32-bit Windows provides 7 pre-registered window classes that are not required to be registered in the code written by the developer. (COMBOBOX EDIT usebox SCROLLBAR ctatic mdiclient)
    • The Application Global window class belongs to the application, and any process generated by this application can be used by this global window class instead of registering. Used in a multi-document program.
    • Application-specific window class is the execution of the process is to fill in the window class structure clauses, Registered window class, belongs to this process, from the process of the build process to register the window class start to the process interrupt this period is active.
  15. What are the three window classes supported by 32-bit Windows? Describes the use of each type of window class.

    • System Global window class, Application Global window class, application-specific window class
  16. Please explain the window class structure name and window class name.

    • See 8
  17. What are some of the loading functions commonly used in window class structures? How do they use it?

    • LoadIcon function
      HICON  WINAPI LoadIcon(     // 返回的指向图标的指针,如果失败,返回NULL    HINSTANCE hInstance,    // 用户定义图标在哪个实例中, NULL为系统图标    LPCSTR lpIconName   // 图标名,也称图标上的标签);
    • LoadCursor () function
      HCURSOR WINAPI LoadCursor (     // 返回新载入的光标的句柄    HINSTANCE hInstance,        // 载入的光标    LPCTSTR lpCursorName)       // 预定义的光标资源名
    • GetStockObject(WHITE_BRUSH);//窗口背景色
  18. What part of the window is the customer area?

    • The portion of the window information that can be written and passed arbitrarily by the application.
  19. Which function is used to make the window client area known as invalid area? Which function gets the coordinates of the invalid area?

    • InvalidateRect function
    • GetUpdateRect function
  20. Windows environment, how to implement device-independent output, why output must pass the GDI function?

    • Establish a data structure for each device in the Windows system, which records the detailed requirements of the device output, such as the color of the text, which is called the device Description table, referred to as the DC. The use of devices in Windows systems is abstracted into the use of DCs. This abstraction of the device is called a DC, which is the key to achieving device independence. Each GDI function invokes the device according to HDC, and the GDI function outputs through the device to the output via a DC.
    • The reason the output must pass through the GDI function is that the output of the device-independent outputs can be obtained when the GDI function output is executed.
  21. Explain the meaning of the code? Explain the meaning of DC?

    • HDC Device Description Table code HDC is a pointer to a device description table. With the HDC designator, programmers can easily draw on the client area. The application knows which window or device to output to, based on the HDC code.
    • DC is the key to achieving device independence.
  22. Explains the procedure for GDI functions to implement device-independent output.

    • The use of devices in Windows systems is abstracted into the use of DCs. This device abstraction is called a DC, which is the key to achieving device independence. Each GDI function invokes the device according to HDC, and the GDI function outputs through the device to the output via a DC.
  23. What are the two ways to get the HDC on the screen?

    1. Using GetDC (hWnd) to obtain window HDC
    2. Method of obtaining HDC with BeginPaint during processing of WM_PAINT messages.
  24. What is the difference between the redraw area determined by invalidaterect and the redrawing area determined by BeginPaint?

    • When the program calls BeginPaint, in most cases, Ferase is flagged as False (0), which means that Windows has erased the background of the invalid rectangle. The ferase clause of the PAINTSTRUCT structure after calling BeginPaint will become true (not 0).
    • While the program invalidates the rectangle in the client area by calling the InvalidateRect function, the last parameter of the function indicates whether to erase the background. If this parameter is False, Windows will not erase the background when the invalidaterect is executed, and the background will be erased instead.
  25. What happens when a wm_create window message is generated? What happens when a WM_PAINT window message is generated?

    • Generate wm_create window message: When executing the CreateWindow function
    • Generate WM_PAINT Window message:
      • When executing the UpdateWindow function
      • Areas that were previously hidden in the window are re-visible when the user moves the window or displays the window.
      • The user changes the size of the window (if the window category style has Cs_hredraw and Cs_vredraw flags set).
      • The program uses the ScrollWindow or SCROLLDC function to scroll through a portion of the area.
      • The program uses the InvalidateRect or INVALIDATERGN function to deliberately generate WM_PAINT messages.
      • Windows erase a dialog box or message box that overrides a portion of a window.
      • (possibly) the menu is pulled out and then released.
      • The tooltip message is displayed (possibly).
  26. Why does the wm_size message follow a WM_PAINT message?

    • Because when we define the window class, we make the class style.CS_HREDRAW|CS_VREDRAW
  27. Explains the range and address of the scrollbar, which function is used to set the range of scrollbars, which function is used to set the address of the scroll bar?

    • The so-called "range" is a pair of integers, representing the minimum and maximum values of the scroll area, i.e. the two ends of the sliding zone;
    • The so-called "address" is the address of the scroll slider within this range. When the scroll slider is at the top (or left) of the scroll area, the address of the scroll slider is the minimum value of the range, and at the bottom (or right) of the scroll bar, the address of the scroll slider is the maximum value of the range.
    • Set Range function: SetScrollRange (HWND,IBAR,IMIN,IMAX,BREDRAW);
    • Set address function: SetScrollPos (HWND,IBAR,IPOS,BREDRAW);
  28. When I click on the scroll bar, the notification code is generated, which parameter is the notification code? What's the meaning?

    • The wparam message parameter is divided into a low field and a high field. WParam's low-character group is a numeric value that indicates the mouse action on the scrollbar, which is called the notification code.
  29. What is the current address of the scroll bar, which is generally an integer? What is the size of the scroll thumb? What is "page size"? What is the scope?

    • The current position of the slider in the slider area, which is the integer value.
    • The size of the slider is the slide length of the slider, which is the current address from the start address of the slider to the slider.
    • The page size display displays the length of the content.
    • The length of the file that the range may display.
  30. What is a GDI object?

    • Some functions do not require device description table designators, which are called GDI objects
    • Class 5 GDI functions: Logic brushes, brushes, bitmap, area, font, and color palette.
    • Graphic output devices are divided into bit-mapped devices (dots), vector-based devices (vectors).
  31. What is the difference between a draw line function and a drawing function?

    • Drawing function not only to draw the bounding box, but also to draw the area to fill in the color, and the drawing line program is only to draw the boundary lines.
  32. What is the function of drawing an ellipse line? What is the function of drawing an ellipse?

    • Arc function
    • Ellipse function
  33. Which three functions are used to create, select, and delete brushes?

    • To create a brush:hPen1 = CreatePen (PS_SOLID, 1, 0); // 宽度为1的黑画笔
    • Select a brush:SelectObject (hdc, hPen1);
    • To delete a brush:DeleteObject (hPen1);
  34. What is the method for obtaining the Device Description table code?

    • Using GetDC (hWnd) to obtain window HDC
    • Method of obtaining HDC with BeginPaint during processing of WM_PAINT messages.
  35. What is the function that gets the information in the Device description table?

    • Ivalue = GetDeviceCaps (Hdc,iindex);
  36. What is the degree of resolution? How does the resolution of the screen differ from the resolution of the printer? How can I calculate the degree of resolution?

    • Resolution: Number of pixels in each unit of measurement
    • Printer: dots per inch
    • Screen: Total number of pixels in vertical and horizontal
    • Calculation: Pixel size divided by common measure size
  37. What is the number of colors in pixels? What are the factors related to it?

    • The number of colors in a graphic in a color display equals the number of colors that a pixel might take.
    • The more binary bits, the more colors are represented and the more pixels are colored.
  38. What does the COLORREF value mean? What is "RGB color"?

    • The COLORREF value is a 32-bit unsigned long integer.
    • The COLORREF value specifies a color according to the brightness of red, green, and blue, usually called "RGB color."
  39. Explain the composition of the device description table. Modify, get the device description table of a property has a special function, generally under what circumstances?

      • composition: [msdn][http://msdn.microsoft.com/zh-cn/library/dd183554%28v=vs.85%29.aspx] or [Chinese][http:// 166.111.4.15/s96300/vc_dist_course/chapter4/4.1.1.htm]
      • When an application uses the GetDC or BeginPaint function to obtain a Device descriptor table handle, Windows automatically sets all of its properties with default values. The application can obtain and modify all property values through the corresponding GDI function call.
      • obtains the device description table:
        • obtains HDC with BeginPaint during processing of WM_PAINT messages: hdc beginpaint (HWND, paintstruct *) and En Dpaint (hwnd, PAINTSTURCT *)
        • obtains HDC during processing of non-WM_PAINT messages: HDC GetDC (HWND) and int ReleaseDC ( HWMD, HDC)
        • get the device content handle for the entire window: HDC GETWINDOWDC (HWND) and int ReleaseDC (HWMD, HDC)
        • Gets the device content handle that is not first closed to a particular window: Hdc=createdc (pszdriver,pszdevice,pszoutput,pdata); and DeleteDC (HDC);   You can use Createc only if you want to obtain device content information for a device's content without drawing it.
      • to save changes to the device description table:
        • add CS_OWNDC
        • Davedc,restoredc
        to the window class when you log in to the window class /li>
  40. What is device coordinates? What is a logical coordinate?

    • In Windows, all devices use uniform coordinates, which are called device coordinates. Device coordinates are the coordinates of the unit of measure in pixels .
    • There is also a length unit in Windows called logical coordinates, which is the coordinate of the mathematical sense, the coordinates in the abstract sense, such as pixels. The coordinates of units of measure, such as unit inches and meters, are called logical coordinates.
  41. Describes the process of keyboard input.

    • Start with the keyboard input, a keyboard input called a keyboard event, keyboard events sent to the Windows system, the Windows system issued a corresponding keyboard message.
  42. What is the window with input focus? What is the active window? How do I identify the active window?

    • A window that receives a specific keyboard message is called a window with input focus.
    • The concept of the input focus is similar to the concept of the active window. The window with the input focus must be the derived window of the active window or the active window.
    • The active window is usually the top-level window. P180
  43. What is System Message Queuing? How does the relationship with application Message Queuing work?

    • System Message Queuing is a stand-alone message queue that is maintained by Windows and is used to initially save messages entered from the keyboard and mouse.
    • When the Windows application finishes processing the previous user input message, Windows pulls the next message from the system message queue and puts it in the application's message sequence.
  44. According to the generated key message, the key is divided into which two categories? What are the four forms of the key message? What are the characteristics of the System Key message? Where is it handled? What is not a system key message?

    • Divided into System Key message and non-system Key message
    • Four different forms:
      • WM_KEYDOWNWM_SYSKEYDOWN
      • WM_KEYUPWM_SYSKEYUP
    • Features: The system Key may be a button or a key combination of several keys, the system key to the Windows system function.
    • The system keyboard message is processed by the default branch DefWindowProc.
    • WM_KEYDOWNWM_KEYUP
  45. What is a scan code? What is a virtual key code? Why use virtual key codes?

    • For early programmers, real keys are generated by keyboard hardware, which is called a scan code in a Windows file.
    • The virtual keyboard is a conceptual keyboard, and the virtual key code is a key code defined by the Windows Designer in the WINUESR.H file with an identifying word.
    • To achieve device independence.
  46. How is the virtual key code for numbers and letters defined?

    • The virtual key codes for numbers and letters are defined in ASCII code.
  47. What is the difference between the wparam and SendMessage functions in the WM_KEYDOWN Message Processing branch of the window function wparam the third parameter?

    • WPARAM in the message processing branch it is the virtual keyboard.
    • And SendMessage in the wparam it is to store the mouse notification code.
  48. How are character messages generated? What are the four character messages? What's the use? What is the structure of character messages?

    • If the virtual key code for a keystroke message is a character code, it produces a character message and puts the character message in the application's message queue. (implemented in the TranslateMessage function)
    • WM_CHAR WM_SYSCHAR WM_DEADCHAR WM_SYSDEADCHAR
    • The character message converts the virtual key code to the ASCII or Unicode code of the character.
    • The lparam parameter is the same as the lparam parameter of the key message that produces the character message, and the virtual key for the wparam parameter is the ANSI or Unicode code for the character.
  49. Mouse is a "must choose Device", how to apply the GetSystemMetrics function to confirm the existence of the mouse?

    • fMouse = GetSystemMetrics (SM_MOUSEPRESENT);
  50. What is a mouse cursor? What kind of diagram is it? What is the hotspot of the mouse?

    • When the user moves the mouse, Windows moves a small graphic on the monitor, which is actually a bitmap, called a "mouse cursor." There is a pixel point on the mouse cursor, which is called the "hotspot" of the mouse cursor.
  51. How are the three keys of a mouse identified? How many mouse messages are there? What is the difference between a mouse message and a keyboard message? What prefix does the virtual key code of mouse message and mouse use each other?

    • Three-button mouse is divided into left, middle, and right, respectively, with Lbutton, Mbutton, rbutton recognition words.
    • There are 21 mouse messages in Windows, of which 11 messages and display areas are irrelevant.
    • Windows can only send keyboard messages to a window function with input focus, and the window function receives a mouse message if the mouse button is pressed across the window or in a window.
    • Wm,mk
  52. How are mouse messages generated? What do the Wparam,lparam in the mouse message represent?

    • By the mouse hardware and mouse driver to transform the mouse event (or mouse action) into a scan code, and then by the Windows operating system to transform the scan code into a mouse virtual key code.
    • WPARAM is the virtual key that presses down the mouse button, LPARAM is the mouse address: The low word group is the X coordinate, the high character group is the Y coordinate.
  53. How did the WM_MOUSEMOVE message arise? What is the characteristic of it?

    • Wm_mousemove messages are generated when you move the mouse over the window display area.
    • The window function receives a mouse message regardless of whether the window is active or has input focus, as long as the mouse button is pressed across the window or in a window.
  54. How does the mouse and shift CTRL keys work together?

    • Getkeystate can use virtual keys Vk_lbutton, Vk_rbutton, Vk_mbutton, Vk_shift, and Vk_control to return the state of the mouse button and the SHIFT key.
  55. What does the wparam and lparam parameters in the display area mouse message represent?

    • The wparam parameter of the display area mouse message is the virtual key code of the key. The lparam parameter is the x and Y addresses of the mouse within the screen coordinates.
  56. What is a child window control?

    • In Windows, a child window that is used as a control is usually referred to as a control, control, and child window control.
  57. What's the difference between SendMessage and PostMessage?

    • Return value types are different
    • PostMessage is asynchronous, SendMessage is synchronous
  58. What are the seven types of predefined control window classes?

    • Button, Edit, Scrollbar, Static, Listbox, MDI, Combobox
  59. What is the function of the notification code? P250 What is the prefix of the notification code generated by the cursor on the keyboard? Please list the prefix of the notification code identifier for the button class, scrolling class, edit class, and list box class.

    • The notification code indicates the window function of the parent window does what works
    • The notification code generated by the cursor on the keyboard is an identifier prefixed with sb_.
    • Button Class Bn_
    • Scrolling class Sb_
    • Edit Class En_
    • List box class Lbn_
  60. Compare the CreateWindow function to create a child window control and create a main window with the CreateWindow function?

    • HWND hWndParent whether the parameter isNULL
    • The window style of the subwindow should have ws_visible
  61. CreateWindow a total of 11 parameters, what is their role? What are the effects on the shape and performance of the child windows created? Why do you want to have ws_visible in the window style of the Subwindow and the main window?

    • CreateWindow:
      HWND CreateWindow(    LPCTSTR lpClassName,    //pointer to register class name     LPCTSTR lpWindowName,    //pointer to window name     DWORD dwstyle,    //window style    int X,    //horizontal position of window     int Y,    //vertical positon of window    int nWidth,    //window width    int nHeight,    //window height    HWND hWndParent,    //handle to parent or owner window    HMENU hMenu,    //handle to menu or child-window identifier    HANDLE hInstance,    //handle to application instance    LPVOID lpParam    //pointer to window-creation data}
    • Ws_visible indicates that the built control is visible and is not used to execute the ShowWindow function
  62. How is wm_command produced?

    • When the mouse clicks the button, the button control sends a WM_COMMAND message to its parent window.
  63. How do I express message delivery between a child window and a parent window?

    • child window, parent window:WM_COMMAND
      • LoWord (wParam) child window ID
      • HiWord (wParam) button notification code
      • LParam Sub-window code
    • child window, parent window: Wm_ and Bm_
  64. What is the purpose of the parent window sending a message to a child window?

    • To interact
  65. What happens when WM_CTLCOLORBTN messages are generated? What's the effect?

    • It is called a control-coloring message, which is a message that is sent by a button control to its parent window function when the button control is colored for its display area.
    • Change the color of the button.
  66. What are the two kinds of scroll bars? How do I distinguish between these two scrollbars? What are the characteristics of scroll bar controls?

    • Window scroll bars and scroll bar controls.
    • The former appears on the right and bottom of the window. The latter is able to appear anywhere in the display area of the parent window. You can use the lparam parameter to distinguish between a window scroll bar or a scrollbar control. The value of the scroll bar for the window is 0, and its value is the code name of the scrollbar control.
  67. What is window sub-class? Describes the purpose and method of subclasses. What type of window function is the child window control?

    • Typically, a Button control (window) is not a window function. If the window function that you want to design for the control must solve the problem of filling the address of the window function with the predefined window class, the technique to solve this problem is called the window subclass.
    • Causes the control window to be associated with its window function.
    • Using the SetWindowLong function to connect the window function of the Subwindow and child window (with the tab switch in the Subwindow), the resulting keyboard message is first entered into the Scrollproc window function when the ScrollBar window has the input focus and the TAB key is moved in the scroll bar window. Processing at the end of the use of CallWindowProc to the Winmai function of the window function WndProc processing, this technique is called "window sub-class."
    • LRESULT CALLBACK
  68. What is a dialog box? What are the different types of dialog boxes? What are the characteristics of each type?

    • The dialog box is started by selecting items in the menu. A dialog box is a downward-pointing pop-up window, also called a drop-down window.
    • The dialog box is divided into two main categories, modal dialogs and non-modal dialog boxes.
    • A modal dialog box is a dialog box that appears when the parent window is temporarily invalidated and the action requested by the dialog box is processed before the control is handed back to the parent window.
    • A modeless dialog box, also known as a coexistence dialog box, appears when its parent window is not invalidated, and the user can move the input focus to the parent window and perform the work of the parent window.
  69. What is the difference between a modal dialog box and a co-existence dialog box's message source?

    • The Coexistence dialog box obtains the message from the message loop in the WinMain, while the modal dialog box's message source is the dialog manager.
  70. What does the message loop for an application that contains a coexistence dialog box have to do?

    • The IsDialogMessage function must be called in the message loop to determine whether the input message is to be sent to the Coexistence dialog box, or, if so, to process the coexistence dialog function, otherwise it will be handled in the same way.
    • The message loop must be modified to the following form:
      while (GetMessage (&msg, NULL, 0, 0)) {    if (hDlgModeless == 0 || !IsDialogMessage (hDlgModeless, &msg)) {        TranslateMessage (&msg) ;        DispatchMessage  (&msg) ;    }}
  71. What is the difference between the establishment and completion of a coexistence dialog and the API functions that are used to establish and end a modal dialog box?

    • The establishment of the Coexistence dialog box is done by the main program startup Createdialog function. End with the DestroyWindow function.
    • Modal dialog box startup function in the application's window function, when the user taps the button, the start function is called in the command message Processing branch, the starting function is: DialogBox (hinstance, TEXT ("AboutBox"), hwnd, ABOUTDLGPROC); The end time of the modal dialog depends on the user, and when the user has the OK button, the Command branch of the dialog function is entered, and the dialog box is closed by the EndDialog (hdlg, 0) function.
  72. What are the features of the modeless dialog box? How to build?

    • The non-modal dialog box allows the user to switch between the dialog box and other programs, and to switch between the dialog box and the window that created the dialog box, but the user cannot switch to another window of the same program until the Non-modal dialog box is cleared. Therefore, a modal dialog box may be more similar to a normal pop-up window that is common to a user program.
    • The non-modal dialog box is created using Createdialog.
  73. How does the modal dialog differ from the message source of the modeless dialog box?

    • Modal dialog messages are emitted from Windows, via the dialog box manager, and then to the dialog function. Instead of modal dialog messages going through Message Queuing, the message loop in the application must be changed. Its message loop must be modified to the following form:
      while (GetMessage (&msg, NULL, 0, 0)) {    if (hDlgModeless == 0 || !IsDialogMessage (hDlgModeless, &msg)) {        TranslateMessage (&msg) ;        DispatchMessage  (&msg) ;    }}
  74. How does a non-modal dialog handle a message?

    • GetMessage Judging whether it is non-modal, is directly IsDialogMessage handled by it, Otherwise it continues to TranslateMessage DispatchMessage be specific:
      while (GetMessage (&msg, NULL, 0, 0)) {    if (hDlgModeless == 0 || !IsDialogMessage(hDlgModeless, &msg)) {        TranslateMessage (&msg) ;        DispatchMessage  (&msg) ;    }}
  75. What is the exact meaning of "resources" in the program?

    • A resource is an icon, a cursor, a string, a menu, a dialog box, a bitmap, a font, and so on. In general, we make the computer's solid parts, devices, components, and so on as the hardware resources of the computer, the Windows operating system of soft parts called software resources.
  76. Suffix. ICO,. CUR,. Bmp. FNT,. What kind of resources does the dlg represent?

    • . ICO icon File
    • . CUR cursor File
    • . BMP image File
    • . FNT Font Files
    • . DLG Digital Line Map
  77. How does an application use resources?

    • Resource source files are compiled into resource binaries through the resource compiler, and the application loads the resource binaries as needed with specialized functions.
  78. Describes the meaning of menus, menu items, pop-up menu items, drop-down menus.

    • Each menu consists of at least one item.
    • The menu item is divided into two types, one is a menu item that can pop up a menu, called a pop-up menu item or a drop-down menu item, and a menu item that cannot pop up a menu.
    • Any menu that contains pop-up menus becomes the "main Menu" or "parent menu" of a drop-down menu, and a drop-down menu becomes a "submenu" or pop-up menu.


Windows Programming Review notes (total 77 questions)

Related Article

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.