Académique Documents
Professionnel Documents
Culture Documents
defined(_UNICODE)
#define _UNICODE
#elif defined(_UNICODE) && !defined(UNICODE)
#define UNICODE
#endif
#include <tchar.h>
#include <windows.h>
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
lParam)
{
HWND hWndHrzScr;
int xNewPos;
hWndHrzScr = CreateWindow("SCROLLBAR",
NULL,
WS_CHILD | SBS_HORZ | WS_VISIBLE,
10,
10,
215,
10,
hwnd,
(HMENU) IDC_HSCROLL,
NULL,
NULL);
break;
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
break;
case WM_HSCROLL:
hWndHrzScr = (HWND)lParam;
xNewPos = GetScrollPos(hWndHrzScr, SB_CTL);
switch(LOWORD(wParam))
{
case SB_LINELEFT:
xNewPos--;
break;
case SB_LINERIGHT:
xNewPos++;
break;
case SB_THUMBPOSITION:
xNewPos = HIWORD(wParam);
break;
case SB_PAGELEFT:
xNewPos--;
break;
case SB_PAGERIGHT:
xNewPos++;
break;
}
case WM_KEYDOWN:
switch(wParam)
{
case VK_SHIFT:
if (GetKeyState(VK_CONTROL) & 0x8000)
{
PostQuitMessage (0);
}
break;
}
break;
return 0;
}