子视窗控制项(三十一)

2010-12-30 21:12:42 · 作者: · 浏览: 33091
wLong (hwnd, GWL_HINSTANCE) ;

// Create the white-rectangle window against which the
// scroll bars will be positioned. The child window ID is 9.

hwndRect = CreateWindow (TEXT ("static"), NULL,
WS_CHILD | WS_VISIBLE | SS_WHITERECT,
0, 0, 0, 0,
hwnd, (HMENU) 9, hInstance, NULL) ;

for (i = 0 ; i < 3 ; i++)
{
// The three scroll bars have IDs 0, 1, and 2, with
// scroll bar ranges from 0 through 255.

hwndScroll[i] = CreateWindow (TEXT ("scrollbar"), NULL,
WS_CHILD | WS_VISIBLE |
WS_TABSTOP | SBS_VERT,
0, 0, 0, 0,
hwnd, (HMENU) i, hInstance, NULL) ;

SetScrollRange (hwndScroll[i], SB_CTL, 0, 255, FALSE) ;
SetScrollPos (hwndScroll[i], SB_CTL, 0, FALSE) ;

// The three color-name labels have IDs 3, 4, and 5,
// and text strings "Red", "Green", and "Blue".

hwndLabel [i] = CreateWindow (TEXT ("static"), zColorLabel[i],
WS_CHILD | WS_VISIBLE | SS_CENTER,
0, 0, 0, 0,
hwnd, (HMENU) (i + 3),
hInstance, NULL) ;

// The three color-value text fields have IDs 6, 7,
// and 8, and initial text strings of "0".

hwndValue [i] = CreateWindow (TEXT ("static"), TEXT ("0"),
WS_CHILD | WS_VISIBLE | SS_CENTER,
0, 0, 0, 0,
hwnd, (HMENU) (i + 6),
hInstance, NULL) ;

OldScroll[i] =