3 /* Win32 counterpart for CalcChildScroll16 is not implemented */
4 /* even in MS Visual C++ */
7 /*#include <wine/winuser16.h>*/
9 void Write (HDC dc, int x, int y, char *s)
11 SetBkMode(dc, TRANSPARENT);
12 TextOut (dc, x, y, s, strlen (s));
15 LRESULT CALLBACK WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l)
17 static short xChar, yChar;
19 static char* strHola = "Hola";
27 GetTextMetrics (dc, &tm);
28 xChar = tm.tmAveCharWidth;
30 GetTextExtentPoint32( dc, strHola, strlen(strHola), ((LPSIZE)&rectHola) + 1 );
31 OffsetRect( &rectHola, xChar, yChar );
37 InvalidateRect(wnd, &rectHola, TRUE );
38 ScrollChildren(wnd, msg, w, l);
42 dc = BeginPaint (wnd, &ps);
43 Write (dc, xChar, yChar, strHola);
52 return DefWindowProc (wnd, msg, w, l);
57 LRESULT CALLBACK WndProc2 (HWND wnd, UINT msg, WPARAM w, LPARAM l)
59 static short xChar, yChar;
69 GetTextMetrics (dc, &tm);
70 xChar = tm.tmAveCharWidth;
76 dc = BeginPaint (wnd, &ps);
77 sprintf(buf,"ps.rcPaint = {left = %d, top = %d, right = %d, bottom = %d}",
78 ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom);
79 rectInfo.left = rectInfo.top = 0;
80 GetTextExtentPoint32 (dc, buf, strlen(buf), ((LPSIZE)&rectInfo) + 1 );
81 OffsetRect (&rectInfo, xChar, yChar );
82 Write (dc, xChar, yChar, buf);
88 InvalidateRect( wnd, &rectInfo, TRUE );
89 /*CalcChildScroll16( (UINT16)GetParent(wnd), SB_BOTH );*/
97 return DefWindowProc (wnd, msg, w, l);
102 int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
107 char className[] = "class"; /* To make sure className >= 0x10000 */
108 char class2Name[] = "class2";
109 char winName[] = "Test app";
112 class.style = CS_HREDRAW | CS_VREDRAW;
113 class.lpfnWndProc = WndProc;
114 class.cbClsExtra = 0;
115 class.cbWndExtra = 0;
116 class.hInstance = inst;
117 class.hIcon = LoadIcon (0, IDI_APPLICATION);
118 class.hCursor = LoadCursor (0, IDC_ARROW);
119 class.hbrBackground = GetStockObject (WHITE_BRUSH);
120 class.lpszMenuName = NULL;
121 class.lpszClassName = className;
122 if (!RegisterClass (&class))
126 wnd = CreateWindow (className, winName, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL,
127 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
131 class.lpfnWndProc = WndProc2;
132 class.lpszClassName = class2Name;
133 class.hbrBackground = GetStockObject(GRAY_BRUSH);
134 if (!RegisterClass (&class))
138 wnd2= CreateWindow (class2Name,"Child window", WS_CAPTION | WS_CHILD | WS_THICKFRAME,
139 50, 50, 350, 100, wnd, 0, inst, 0);
141 ShowWindow (wnd, show);
143 ShowWindow (wnd2, show);
146 while (GetMessage (&msg, 0, 0, 0)){
147 TranslateMessage (&msg);
148 DispatchMessage (&msg);