PDA

View Full Version : Slide bar for speed control



08-27-2001, 01:08 AM
How to insert a slidebar in a child window? I want to control speed of my object through this interface. All my attempts have failed.
What is the name of the class for Slider and what flags should I use? It is pure Win32. Please give some hint. http://www.opengl.org/discussion_boards/ubb/confused.gif
CreateWindowEx (WS_EX_LEFT, "Slider",
NULL,
WS_CHILD | WS_VISIBLE| WS_BORDER | WS_TABSTOP,
3, 3,
8, 8,
hwnd, (HMENU) 1,
((LPCREATESTRUCT) lParam)->hInstance, NULL) ;

mikael_aronsson
08-27-2001, 11:04 AM
It's a bit difficult to explain all the details here, have a look at msdn.microsoft.com for all the details please:

InitCommonControls(); // loads common control's DLL

hwndTrack = CreateWindowEx(
0, // no extended styles
TRACKBAR_CLASS, // class name
"Trackbar Control", // title (caption)
WS_CHILD | WS_VISIBLE |
TBS_AUTOTICKS | TBS_ENABLESELRANGE, // style
10, 10, // position
200, 30, // size
hwndDlg, // parent window
ID_TRACKBAR, // control identifier
g_hinst, // instance
NULL // no WM_CREATE parameter
);

Mikael

08-27-2001, 08:14 PM
Thank you very much, your answer is more than I expected. Hmm, I thought that all this control classes are already loaded.

mikael_aronsson
08-28-2001, 07:08 AM
For some stupid reason you have to call InitCommonControls() before you use any of the new controls that came with Windows95, I am not sure about the reason, but I agree it's not very logical.

Mikael