Release 960314
[wine/multimedia.git] / libtest / new.c
blob8dfabced7ff257dcf01491893a0a80c8786f6992
1 #include <windows.h>
3 HANDLE ghInstance;
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" ;
13 HWND hwnd ;
14 MSG msg ;
15 WNDCLASS wndclass ;
17 ghInstance = hInstance;
18 if (!hPrevInstance)
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) ;
47 UpdateWindow (hwnd) ;
49 while (GetMessage (&msg, NULL, 0, 0))
51 TranslateMessage (&msg) ;
52 DispatchMessage (&msg) ;
54 return msg.wParam ;
57 long FAR PASCAL WndProc (HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam)
59 HDC hdc ;
60 PAINTSTRUCT ps ;
61 RECT rect ;
62 WNDCLASS wndclass ;
64 static HWND hChild;
66 switch (message)
68 case WM_CREATE :
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);
86 case WM_PAINT :
87 hdc = BeginPaint (hwnd, &ps) ;
89 GetClientRect (hwnd, &rect) ;
91 DrawText (hdc, "Hello, Windows!", -1, &rect,
92 DT_SINGLELINE | DT_CENTER | DT_VCENTER) ;
94 EndPaint (hwnd, &ps);
95 return 0 ;
97 case WM_DESTROY :
98 PostQuitMessage (0) ;
99 return 0 ;
101 return DefWindowProc (hwnd, message, wParam, lParam) ;
104 long FAR PASCAL ChildProc(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam)
106 HDC hDC;
107 PAINTSTRUCT ps;
108 WNDCLASS wndClass;
109 char* classes[]={"EDIT","BUTTON","LISTBOX","STATIC","SCROLLBAR","COMBOBOX","COMBOLBOX", NULL};
110 char** curr;
111 char buf[256];
112 RECT rect ;
113 int i;
115 switch (message) {
116 case WM_PAINT:
117 curr = classes;
118 i=0;
119 hDC = BeginPaint(hwnd, &ps);
120 SelectObject(hDC,GetStockObject(ANSI_FIXED_FONT));
121 while (*curr) {
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)) ;
137 i += 15;
138 curr++;
140 /* EndPaint(hwnd, &ps);
141 break;
142 hDC = BeginPaint(hwnd, &ps);
144 MoveTo(hDC, 0, 0);
145 LineTo(hDC, 500, 500);
146 EndPaint(hwnd, &ps);
147 break;
148 default:
149 return DefWindowProc (hwnd, message, wParam, lParam) ;
151 return (0L);