6 LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
7 LRESULT CALLBACK ChildProc (HWND, UINT, WPARAM, LPARAM);
9 int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance,
10 LPSTR lpszCmdParam, int nCmdShow)
12 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 szAppName, /* 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 LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
63 char clsName[] = "SecondClass";
70 wndclass.style = CS_PARENTDC | CS_HREDRAW | CS_VREDRAW;
71 wndclass.lpfnWndProc = ChildProc ;
72 wndclass.cbClsExtra = 0 ;
73 wndclass.cbWndExtra = 0 ;
74 wndclass.hInstance = ghInstance ;
75 wndclass.hIcon = NULL ;
76 wndclass.hCursor = LoadCursor (NULL, IDC_CROSS) ;
77 wndclass.hbrBackground = GetStockObject (LTGRAY_BRUSH) ;
78 wndclass.lpszMenuName = NULL ;
79 wndclass.lpszClassName = clsName;
81 RegisterClass (&wndclass);
83 hChild = CreateWindow(clsName,"Child Window",
84 WS_CHILD | WS_VISIBLE | WS_BORDER,
85 10, 10, 580, 380, hwnd, NULL, ghInstance, NULL);
86 ShowWindow(hChild, SW_SHOW);
88 hdc = BeginPaint (hwnd, &ps) ;
90 GetClientRect (hwnd, &rect) ;
92 DrawText (hdc, "Hello, Windows!", -1, &rect,
93 DT_SINGLELINE | DT_CENTER | DT_VCENTER) ;
102 return DefWindowProc (hwnd, message, wParam, lParam) ;
105 LRESULT CALLBACK ChildProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
110 char *classes[]={"EDIT","BUTTON","LISTBOX","STATIC","SCROLLBAR","COMBOBOX","COMBOLBOX", NULL};
120 hDC = BeginPaint(hwnd, &ps);
121 SelectObject(hDC,GetStockObject(ANSI_FIXED_FONT));
123 wsprintf(buf,"%12s:",*curr);
124 GetClassInfo(NULL, *curr, &wndClass);
125 if(wndClass.style&CS_VREDRAW) lstrcat(buf," | CS_VREDRAW");
126 if(wndClass.style&CS_HREDRAW) lstrcat(buf," | CS_HREDRAW" );
127 if(wndClass.style&CS_KEYCVTWINDOW) lstrcat(buf," | CS_KEYCVTWINDOW" );
128 if(wndClass.style&CS_DBLCLKS) lstrcat(buf," | CS_DBLCLKS" );
129 if(wndClass.style&CS_OWNDC) lstrcat(buf," | CS_OWNDC" );
130 if(wndClass.style&CS_CLASSDC) lstrcat(buf," | CS_CLASSDC" );
131 if(wndClass.style&CS_PARENTDC) lstrcat(buf," | CS_PARENTDC" );
132 if(wndClass.style&CS_NOKEYCVT) lstrcat(buf," | CS_NOKEYCVT" );
133 if(wndClass.style&CS_NOCLOSE) lstrcat(buf," | CS_NOCLOSE" );
134 if(wndClass.style&CS_SAVEBITS) lstrcat(buf," | CS_SAVEBITS" );
135 if(wndClass.style&CS_GLOBALCLASS) lstrcat(buf," | CS_GLOBALCLASS");
136 GetClientRect (hwnd, &rect) ;
137 TextOut (hDC, 5,20+i,buf,lstrlen(buf)) ;
141 /* EndPaint(hwnd, &ps);
143 hDC = BeginPaint(hwnd, &ps);
145 MoveToEx(hDC, 0, 0, NULL);
146 LineTo(hDC, 500, 500);
150 return DefWindowProc (hwnd, message, wParam, lParam) ;