I am trying to use the WS_VSCROLL style on an edit control and use a flat scrollbar. I found this codeproject article: http://www.codeproject.com/editctrl/ceditex.asp and decided to try to mimic such behavior in Win32. The only thing I am trying:

Code:
// In the Message map
ON_CONTROL_REFLECT(EN_VSCROLL, OnVscroll)

void CEditEx::OnVscroll()
{
    InitializeFlatSB(GetSafeHwnd());
    // Use the flat scrollbar feature provided by Microsoft.
    // See MSDN for this API
}
And my implementation:

Code:
		case WM_COMMAND:
			if(HIWORD(wParam) == EN_VSCROLL && LOWORD(wParam) == IDC_EDITMAIN)
			{
				::InitializeFlatSB(HWND(lParam));
			}
			break;
It seems to generally wrok, but when I click the up or down arrows, the XP styled scrollbar comes back for a second.

Also, if I click the scrollbar and drag it to the top, it will jump down to the bottom after releasing the mouse, but not scroll down to the bottom, and trying to click it again makes it turn brown and then it restores itself after a second.

http://img.photobucket.com/albums/v2...o1/fckedup.jpg

This is pretty bizarre and I don't understand what is going on with this, or how to fix it. If it is not possible, can I make an owner drawn scrollbar control?