views:

599

answers:

4

How do I make one? I am kind of a newbie in Windows API. Is there some sort of manual for this sort of thing? I am specifically interested in a Core API. Thank you for any help.

A: 

What do you mean with "infinite"?

If you mean a scroll bar where the user can never scroll to the ends, you have to handle the scroll bar's position change notifications and reset the position to the middle.

CL
+1  A: 

The scroll bar reference documentation on MSDN is here. There's an article, Scroll Bar Controls in Win32, that you may find useful.

ChrisN
A: 

In windows, the 'core' api you speak of is called Win32. No one says 'core'.

Joel Coehoorn
+1  A: 

There are three ways of doing scroll bars: A window's scroll bar; a scroll bar control; or a custom control.

Windows have scroll bars in the non-client (NC) area. These are part of the window frame, and as such they do not have their own window handle or anything.

Scroll bar controls are child window implementations of a scroll bar. Because they are child windows, they offer you a bit more flexibility. You could subclass or superclass one of these controls to implement "infinite" functionality.

The final option is a custom control: you just create your own scroll bar from scratch. Create a single child window, draw it yourself, handle all the mouse and keyboard input yourself, and implement the scroll bar messages yourself. This isn't actually as hard as it may sound.

I'd probably recommend superclassing a scroll bar control. Process the scroll messages in your own scroll bar wndproc, and fall back to the standard scroll bar wndproc for painting and such.

MrZebra