Win32 Windows Programming 12

Source: Internet
Author: User

First, dialog box

1, the Classification of the dialog box

2, the Basic Use of dialog box

3. dialog box Resources

4, the Use of modal dialog box

5, the Use of modeless dialog box

5.1 Adding a dialog box resource

5.2 Defining window processing functions

BOOL CALLBACK DialogProc (

HWND hwnd,

UINT umsg,

WPARAM WPARAM,

LPARAM LPARAM

)

5.3 Creating a Dialog box

HWND createdialog (  hinstance  hinstance,  //Handle to Module  LPCTSTR lptemplate ,    dialog box template name  HWND  hwndparent,      //Handle to owner window C19/>dlgproc  lpdialogfunc  //dialog box procedure);
The return value is the created dialog window handle.

5.4 Display dialog box

ShowWindow

5.5 Closing the dialog box

EndDialog

5.6 Compared to a modal dialog box

Create a function: Modal creation dialog Box DialogBox

modeless dialog box; Createdialog

Program Execution mode: modal dialog block, no other window input.

The modeless dialog box returns immediately to allow the main program to continue execution

6 dialog box messages

The WM_INITDIALOG message, used similar to the WM_CREATE message, can be initialized after the dialog box is created.

Unlike wm_create, the WM_INITDIALOG message is sent to the dialog window handler after all child controls (buttons, etc.) on the Resource template of the dialog box are created.

WParam-Current accept Input focus child control window handle

LParam-parameters included with creation

7 Comparison of dialog boxes and normal Windows

7.1 Creation in different ways

Normal window Createwindow/ex

dialog box: Dialogbox/createdialog

7.2 News

Normal window: Will receive wm_create

dialog box: wm_initdialog

7.3 Closing Mode

Normal window: DestroyWindow, etc.

dialog box: EndDialog

Two child controls

1 window types defined by the Windows system can provide

Corresponding functions, including buttons, text edit boxes, static boxes

2 Creation of space

can be created using Createwindow/createwindowex and get to the space HWND. Each child control must have a corresponding ID number when it is created.

The ID number is as demanding as possible.

1.3 Message for the control

The interchange of the child control and the parent window (the Normal window or dialog box) is done through the message. If the child window state changes, the child window is sent to the parent window

The corresponding message,

The General parent window uses SendMessage to send messages to child windows, while messages sent by parent windows in response to child windows are typically processed in WM_COMMAND

Three-static box

1 Creating a static box

Name of the window class-STATIC, used to display text on the window, etc., if you use Ss_icon, Ss_bitmap style can display ICON and bitmap

Text static box-use ss_simple when creating

Icon static box-use Ss_icon when creating, and set the window name of the static box to the resource ID number of the corresponding ICON, for example "#101"


2 command response for a static box

2.1 Freak to add ss_notify style

2.2 wm_command for processing

Wparam-hiword command ID

LoWord window ID of the static box

LPARAM-static frame Create library handle

3 Static box related messages











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.