Common Controls for Assembly tutorials

Source: Internet
Author: User
Tags api manual resource win32

In this lesson, we'll learn what generic controls are and how to use them.

Theory:

WIN95 has several enhanced user interface controls relative to the win3x. In fact, these controls are in use before the WIN95 is officially released, such as: status bar, tool bar, etc. Programmers used to program them themselves, and now Microsoft has included them in Win9x and Winnt.

Toolbar---tool bar

TOOLTIP---hint text

Status Bar---State bar

Property sheet---Properties page list

Property Page---Properties sheet

Tree view---TreeView

List View---listing views

Animation---Animation

Drag List---can handle drag-drop listbox

Header---

Hot-key---Hotkey

Image list---image linked list

Progress Bar---process status bar

Right Edit---

Tab---Table of tabs

TRACKBAR---tracking bar

Up-down---scroll bar

Because the number of common controls is very large, it is wasteful to load them all into memory and register them. The executable code for other controls except the rich text editing control is placed in Comctl32.dll so that other applications can use them. The rich text editing control is also larger than other controls in RichedXX.dll because the control is very complex.

To load Comctl32.dll, you can call function InitCommonControls in your application. The InitCommonControls function is a function in a dynamic-link library comctl32.dll that, if referenced anywhere in your program, causes the Windows program Loader PE loader to load the library. The function InitCommonControls actually has only one instruction "ret", its sole purpose is to make the "introduce" in the PE header of the executable file of the application that called the function. The section contains Comctl32.dll so that whenever the application loads the library for you. So the real initialization work is done at the entry point of the library, where all the generic control classes are registered, and then all the generic controls can be created on these classes, just like creating other child window controls.

Rich text editing controls are different. If you want to use it, you must call the LoadLibrary function to load dynamically, and call FreeLibrary to unload dynamically.

Now we learn how to create these generic controls. You can use the resource editor to put them in a dialog box, or you can call the related functions yourself to create them manually. Almost all common controls are created by calling function CreateWindowEx or CreateWindow, where you pass the generic control's class name. There are some common controls that have special creation functions, but in fact these functions call CreateWindowEx in the interior, but the wrapped function is easier to use. The packaged functions are:

CreateToolbarEx
CreateStatusWindow
CreatePropertySheetPage
PropertySheet
ImageList_Create

In order to create common controls you must know their class name, we rank the class in the following:

Class name Generic control

ToolbarWindow32 Toolbar
tooltips_class32 Tooltip
msctls_statusbar32 Status bar
SysTreeView32 Tree view
SysListView32 List view
SysAnimate32 Animation
SysHeader32 Header
msctls_hotkey32 Hot-key
msctls_progress32 Progress bar
RICHEDIT Rich edit
msctls_updown32 Up-down
SysTabControl32 Tab

The property sheets, property pages, and image list controls have their own creation functions. The Drag list is actually a scalable listbox control, so it doesn't have its own class name. The class name above is provided by the VC + + resource Editor, and they are not the same as those presented in the Borland Company's WIN32 API guide, and Petzold's book programming Windows 95. To be sure, the class names listed above are absolutely accurate. These generic controls can have some style of common window classes, such as Ws_child. They certainly have other special styles, such as the tree view control has a tvs_xxxxx style, the list control has a lvs_xxxx style. The best way to find out about the WIN32 API function guide. Now that we know how to create a generic control, we can talk about how these common controls communicate with each other and with their parent windows. Unlike child window controls, common controls send wm_notify messages and parent windows when some state changes rather than by sending Wm_command. The parent window can control the behavior of the child window by sending a message. For those new generic controls, there are new message types. You can refer to your WIN32 API manual.

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.