3 /* Win32 counterpart for CalcChildScroll16 is not implemented */
4 /* even in MS Visual C++ */
5 #include <wine/winuser16.h>
7 void Write (HDC dc
, int x
, int y
, char *s
)
9 SetBkMode(dc
, TRANSPARENT
);
10 TextOut (dc
, x
, y
, s
, strlen (s
));
13 LRESULT CALLBACK
WndProc (HWND wnd
, UINT msg
, WPARAM w
, LPARAM l
)
15 static short xChar
, yChar
;
17 static char* strHola
= "Hola";
25 GetTextMetrics (dc
, &tm
);
26 xChar
= tm
.tmAveCharWidth
;
28 GetTextExtentPoint32( dc
, strHola
, strlen(strHola
), ((LPSIZE
)&rectHola
) + 1 );
29 OffsetRect( &rectHola
, xChar
, yChar
);
35 InvalidateRect(wnd
, &rectHola
, TRUE
);
36 ScrollChildren(wnd
, msg
, w
, l
);
40 dc
= BeginPaint (wnd
, &ps
);
41 Write (dc
, xChar
, yChar
, strHola
);
50 return DefWindowProc (wnd
, msg
, w
, l
);
55 LRESULT CALLBACK
WndProc2 (HWND wnd
, UINT msg
, WPARAM w
, LPARAM l
)
57 static short xChar
, yChar
;
67 GetTextMetrics (dc
, &tm
);
68 xChar
= tm
.tmAveCharWidth
;
74 dc
= BeginPaint (wnd
, &ps
);
75 sprintf(buf
,"ps.rcPaint = {left = %d, top = %d, right = %d, bottom = %d}",
76 ps
.rcPaint
.left
,ps
.rcPaint
.top
,ps
.rcPaint
.right
,ps
.rcPaint
.bottom
);
77 rectInfo
.left
= rectInfo
.top
= 0;
78 GetTextExtentPoint32 (dc
, buf
, strlen(buf
), ((LPSIZE
)&rectInfo
) + 1 );
79 OffsetRect (&rectInfo
, xChar
, yChar
);
80 Write (dc
, xChar
, yChar
, buf
);
86 InvalidateRect( wnd
, &rectInfo
, TRUE
);
87 CalcChildScroll16( (UINT16
)GetParent(wnd
), SB_BOTH
);
95 return DefWindowProc (wnd
, msg
, w
, l
);
100 int PASCAL
WinMain (HANDLE inst
, HANDLE prev
, LPSTR cmdline
, int show
)
105 char className
[] = "class"; /* To make sure className >= 0x10000 */
106 char class2Name
[] = "class2";
107 char winName
[] = "Test app";
110 class.style
= CS_HREDRAW
| CS_VREDRAW
;
111 class.lpfnWndProc
= WndProc
;
112 class.cbClsExtra
= 0;
113 class.cbWndExtra
= 0;
114 class.hInstance
= inst
;
115 class.hIcon
= LoadIcon (0, IDI_APPLICATION
);
116 class.hCursor
= LoadCursor (0, IDC_ARROW
);
117 class.hbrBackground
= GetStockObject (WHITE_BRUSH
);
118 class.lpszMenuName
= NULL
;
119 class.lpszClassName
= className
;
120 if (!RegisterClass (&class))
124 wnd
= CreateWindow (className
, winName
, WS_OVERLAPPEDWINDOW
| WS_CLIPCHILDREN
| WS_VSCROLL
| WS_HSCROLL
,
125 CW_USEDEFAULT
, 0, CW_USEDEFAULT
, 0, 0,
129 class.lpfnWndProc
= WndProc2
;
130 class.lpszClassName
= class2Name
;
131 class.hbrBackground
= GetStockObject(GRAY_BRUSH
);
132 if (!RegisterClass (&class))
136 wnd2
= CreateWindow (class2Name
,"Child window", WS_CAPTION
| WS_CHILD
| WS_THICKFRAME
,
137 50, 50, 350, 100, wnd
, 0, inst
, 0);
139 ShowWindow (wnd
, show
);
141 ShowWindow (wnd2
, show
);
144 while (GetMessage (&msg
, 0, 0, 0)){
145 TranslateMessage (&msg
);
146 DispatchMessage (&msg
);