6 long FAR PASCAL
WndProc (HWND
, WORD
, WPARAM
, LPARAM
);
7 long FAR PASCAL
ChildProc(HWND
, WORD
, WPARAM
, LPARAM
);
9 int PASCAL
WinMain (HANDLE hInstance
, HANDLE hPrevInstance
,
10 LPSTR lpszCmdParam
, int nCmdShow
)
12 static char szAppName
[] = "ClassLook" ;
17 ghInstance
= hInstance
;
20 wndclass
.style
= CS_HREDRAW
| CS_VREDRAW
;
21 wndclass
.lpfnWndProc
= WndProc
;
22 wndclass
.cbClsExtra
= 0 ;
23 wndclass
.cbWndExtra
= 0 ;
24 wndclass
.hInstance
= hInstance
;
25 wndclass
.hIcon
= LoadIcon (NULL
, IDI_APPLICATION
) ;
26 wndclass
.hCursor
= LoadCursor (NULL
, IDC_ARROW
) ;
27 wndclass
.hbrBackground
= GetStockObject (WHITE_BRUSH
) ;
28 wndclass
.lpszMenuName
= NULL
;
29 wndclass
.lpszClassName
= szAppName
;
31 RegisterClass (&wndclass
) ;
34 hwnd
= CreateWindow (szAppName
, /* window class name */
35 "ClassLook", /* window caption */
36 WS_OVERLAPPEDWINDOW
, /* window style */
37 CW_USEDEFAULT
, /* initial x position */
38 CW_USEDEFAULT
, /* initial y position */
39 600, /* initial x size */
40 400, /* initial y size */
41 NULL
, /* parent window handle */
42 NULL
, /* window menu handle */
43 hInstance
, /* program instance handle */
44 NULL
) ; /* creation parameters */
46 ShowWindow (hwnd
, nCmdShow
) ;
49 while (GetMessage (&msg
, NULL
, 0, 0))
51 TranslateMessage (&msg
) ;
52 DispatchMessage (&msg
) ;
57 long FAR PASCAL
WndProc (HWND hwnd
, WORD message
, WPARAM wParam
, LPARAM lParam
)
69 wndclass
.style
= CS_PARENTDC
| CS_HREDRAW
| CS_VREDRAW
;
70 wndclass
.lpfnWndProc
= ChildProc
;
71 wndclass
.cbClsExtra
= 0 ;
72 wndclass
.cbWndExtra
= 0 ;
73 wndclass
.hInstance
= ghInstance
;
74 wndclass
.hIcon
= NULL
;
75 wndclass
.hCursor
= LoadCursor (NULL
, IDC_CROSS
) ;
76 wndclass
.hbrBackground
= GetStockObject (LTGRAY_BRUSH
) ;
77 wndclass
.lpszMenuName
= NULL
;
78 wndclass
.lpszClassName
= "SecondClass" ;
80 RegisterClass (&wndclass
);
82 hChild
= CreateWindow("SecondClass","Child Window",
83 WS_CHILD
| WS_VISIBLE
| WS_BORDER
,
84 10, 10, 580, 380, hwnd
, NULL
, ghInstance
, NULL
);
85 ShowWindow(hChild
, SW_SHOW
);
87 hdc
= BeginPaint (hwnd
, &ps
) ;
89 GetClientRect (hwnd
, &rect
) ;
91 DrawText (hdc
, "Hello, Windows!", -1, &rect
,
92 DT_SINGLELINE
| DT_CENTER
| DT_VCENTER
) ;
101 return DefWindowProc (hwnd
, message
, wParam
, lParam
) ;
104 long FAR PASCAL
ChildProc(HWND hwnd
, WORD message
, WPARAM wParam
, LPARAM lParam
)
109 char* classes
[]={"EDIT","BUTTON","LISTBOX","STATIC","SCROLLBAR","COMBOBOX","COMBOLBOX", NULL
};
119 hDC
= BeginPaint(hwnd
, &ps
);
120 SelectObject(hDC
,GetStockObject(ANSI_FIXED_FONT
));
122 wsprintf(buf
,"%12s:",*curr
);
123 GetClassInfo(NULL
, *curr
, &wndClass
);
124 if(wndClass
.style
&CS_VREDRAW
) lstrcat(buf
," | CS_VREDRAW");
125 if(wndClass
.style
&CS_HREDRAW
) lstrcat(buf
," | CS_HREDRAW" );
126 if(wndClass
.style
&CS_KEYCVTWINDOW
) lstrcat(buf
," | CS_KEYCVTWINDOW" );
127 if(wndClass
.style
&CS_DBLCLKS
) lstrcat(buf
," | CS_DBLCLKS" );
128 if(wndClass
.style
&CS_OWNDC
) lstrcat(buf
," | CS_OWNDC" );
129 if(wndClass
.style
&CS_CLASSDC
) lstrcat(buf
," | CS_CLASSDC" );
130 if(wndClass
.style
&CS_PARENTDC
) lstrcat(buf
," | CS_PARENTDC" );
131 if(wndClass
.style
&CS_NOKEYCVT
) lstrcat(buf
," | CS_NOKEYCVT" );
132 if(wndClass
.style
&CS_NOCLOSE
) lstrcat(buf
," | CS_NOCLOSE" );
133 if(wndClass
.style
&CS_SAVEBITS
) lstrcat(buf
," | CS_SAVEBITS" );
134 if(wndClass
.style
&CS_GLOBALCLASS
) lstrcat(buf
," | CS_GLOBALCLASS");
135 GetClientRect (hwnd
, &rect
) ;
136 TextOut (hDC
, 5,20+i
,buf
,lstrlen(buf
)) ;
140 /* EndPaint(hwnd, &ps);
142 hDC = BeginPaint(hwnd, &ps);
145 LineTo(hDC
, 500, 500);
149 return DefWindowProc (hwnd
, message
, wParam
, lParam
) ;