Hello,
I'd just like to take a few moments to say how surprised I was to find a "semi"-active forum regarding WinAPI, I got interested in it by reading theForger's WinProg tutorial but I was left stranded when I needed "immediate" support, they reference the EFNET's #Winprog but whenever I logged on with a problem I was greeted with everlasting silence, or they would just completely ignore me and proceed with their own subjects. It was really frustrating.
There's a lot of content out there but pretty much all of it is dated and I can't tell you how many times I've found broken links to MSDN that left me dead in the water.

But enough ranting, on with the problem.

It's pretty simple, whenever the user clicks the trackbar I want the Thumb(value) to be positioned at that point, an example of this at work would be any MediaPlayer out there, VLC / MPC / WMP /etc...
In this topic the user Kevin Spencer suggests an approach but from what I've seen the results aren't that great.

The problem is that the Thumb only changes position reliably in the interval [ 40%, 70%], after that it starts deviating severely, 0-40 the offset is smaller than it is on 70-100, by offset I mean the distance between the cursor and the Thumb.
I've also noticed that if I click the area 0-3% the Thumb sets it self at 3%, and 96-100 to 96%.

This is clearly a problem with the equation, I've implemented Kevin Spencer's suggestion as such:
Code:
		case WM_HSCROLL:
		{
			POINT curPos = {0, 0};
			RECT rc;
			int totalVal	=	0;
			int totalPx		=	0;
			int mousePx		=	0;
			float fraction	=	0;
			int mouseVal	=	0;

			char test[50] = "";

			if( LOWORD(wParam) == TB_PAGEUP | TB_PAGEDOWN)
			{
				GetCursorPos(&curPos);
				GetWindowRect((HWND)lParam, &rc);

				totalVal	=	SendMessage( (HWND)lParam, TBM_GETRANGEMAX, 0, 0) - SendMessage( (HWND)lParam, TBM_GETRANGEMIN, 0, 0);

				totalPx		=	rc.right - rc.left;

				mousePx		=	curPos.x - rc.left;

				fraction	=	(float)mousePx / totalPx;

				mouseVal	=	fraction * totalVal;

				SendMessage((HWND)lParam, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)mouseVal);


			}

		}
		break;
It seems to me that part of the problem is that the equation is percentage based, and that is always going to have an error margin, but it shouldn't be this large IMO.

I got nowhere with my own approaches, closest I've come wields the same results as the Spencer's algorithm.

Furthermore the action of "dragging the Thumb" is getting captured in this as well, even though it shouldn't, I haven't yet figured out how to filter all the actions but clicking a point on the Trackbar and dragging the thumb.

I welcome all replies.


One last thing, is anyone aware of a good real time support line for WinAPI i.e. IRC channel that isn't dead?
I hope I don't get misinterpreted as a "leecher", I'd gladly participate in a community, I just haven't found an active one yet.

Thank you for your time.