对话方块(三十六)

2010-12-30 21:13:56 · 作者: · 浏览: 41390
////////////////////////////
// Icon
ABOUT3 ICON DISCARDABLE "icon1.ico"
 RESOURCE.H (摘录)
// Microsoft Developer Studio generated include file.
// Used by About3.rc

#define IDM_APP_ABOUT 40001
#define IDC_STATIC -1
ABOUT3.ICO


 

我们所注册的视窗类别叫做「EllipPush」(椭圆形按键)。在Developer Studio的对话方块编辑器中,删除「Cancel」和「OK」按钮。要添加依据此视窗类别的控制项,请从「 Controls 」工具列选择「 Custom Control 」。在此控制项的「 Properties 」对话方块的「 Class 」栏位输入「 EllipPush 」。在对话方块模板中我们没有使用DEFPUSHBUTTON叙述,而是用CONTROL叙述来指定此视窗类别:

CONTROL "OK" IDOK, "EllipPush", TABGRP, 64, 60, 32, 14

当在对话方块中建立子视窗控制项时,对话方块管理器把这个视窗类别用於CreateWindow呼叫中。

ABOUT3.C程式在WinMain中注册了EllipPush视窗类别:

wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = EllipPushWndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = NULL ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) (COLOR_WI