需要一个同API写的滑动条的例子

求助需要一个同API写的滑动条的例子
求助   如上

------解决方案--------------------
#include <windows.h>

#include "sysmets.h "


LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,

PSTR szCmdLine, int iCmdShow)

{

static TCHAR szAppName[] = TEXT ( "SysMets ") ;

HWND hwnd ;

MSG msg ;

WNDCLASS wndclass ;

wndclass.style = CS_HREDRAW | CS_VREDRAW ;

wndclass.lpfnWndProc = WndProc ;

wndclass.cbClsExtra = 0 ;

wndclass.cbWndExtra = 0 ;

wndclass.hInstance = hInstance ;

wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;

wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;

wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;

wndclass.lpszMenuName = NULL ;

wndclass.lpszClassName = szAppName ;



if (!RegisterClass (&wndclass))

{

MessageBox ( NULL, TEXT ( "Program requires Windows NT! "),

szAppName, MB_ICONERROR) ;

return 0 ;

}



hwnd = CreateWindow (szAppName, TEXT ( "Get System Metrics "),

WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,

CW_USEDEFAULT, CW_USEDEFAULT,

CW_USEDEFAULT, CW_USEDEFAULT,

NULL, NULL, hInstance, NULL) ;



ShowWindow (hwnd, iCmdShow) ;

UpdateWindow (hwnd) ;



while (GetMessage (&msg, NULL, 0, 0))

{

TranslateMessage (&msg) ;

DispatchMessage (&msg) ;

}

return msg.wParam ;

}

------解决方案--------------------
刚巧前段时间写了一个,其实msdn是有例子的

#define TOTAL_LINE_CNT 10000
#define MAX_SCROLL_VAL 100

LRESULT CALLBACK WindowProcedure (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
char szTextBuf[128];

TEXTMETRIC tm;

static int iCharHigh;
static int iLineCntInView;

static int iCurStartLine;

int iOldPos;
int iOldStartLine;
RECT rt;
RECT textrt;
int i; // loop counter
SCROLLINFO si;

switch (message) /* handle the messages */
{
case WM_CREATE: