When sliding the trackbar and release the mouse button, the whole window flashes and the tabs dissappear.
When I use the old version, everything works properly!
When I use the new Microsoft Windows Common Controls ver.6.0, this problem is observed !!!
#include <windows.h>
#include <commctrl.h>
#include <tchar.h>
#pragma comment(lib,"comctl32.lib")
HWND hWin, hTab;
#if defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
LRESULT CALLBACK WndProcedure( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ) {
switch( Msg ) {
case WM_CREATE:{
HINSTANCE hInst = GetModuleHandle( NULL );
RECT rc;
int dx, dy;
GetClientRect( hWnd, &rc );
dx = rc.right - rc.left;
dy = rc.bottom - rc.top;
TCITEM tie = { TCIF_TEXT | TCIF_IMAGE, 0, 0, NULL, 0, -1, 0 };
hTab = CreateWindowEx( NULL, WC_TABCONTROL, _T(""), WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS, 0, 0, dx, dy, hWnd, ( HMENU )( DWORDLONG )1001, hInst, NULL );
tie.pszText = _T("Tab One");
TabCtrl_InsertItem( hTab, 0, &tie );
tie.pszText = _T("Tab Two");
TabCtrl_InsertItem( hTab, 1, &tie );
CreateWindowEx( NULL, TRACKBAR_CLASS, _T(""), WS_VISIBLE | WS_CHILD | WS_TABSTOP, 50, 50, 200, 40, hTab, ( HMENU )1002, hInst, NULL );
}
break;
case WM_NOTIFY: {
LPNMHDR ns = (LPNMHDR)lParam;
if( (ns->idFrom == 1001) && (ns->code == TCN_SELCHANGING) )
return FALSE;
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return (DefWindowProc(hWnd, Msg, wParam, lParam));
}
return FALSE;
}
INT WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) {
INITCOMMONCONTROLSEX icc = { sizeof( INITCOMMONCONTROLSEX ), ICC_WIN95_CLASSES };
WNDCLASSEX WndClsEx;
MSG Msg;
ZeroMemory( &WndClsEx, sizeof( WNDCLASSEX ) );
WndClsEx.cbSize = sizeof(WNDCLASSEX);
WndClsEx.style = CS_HREDRAW | CS_VREDRAW;
WndClsEx.lpfnWndProc = WndProcedure;
WndClsEx.hIcon = LoadIcon( NULL, IDI_APPLICATION );
WndClsEx.hCursor = LoadCursor(NULL, IDC_ARROW );
WndClsEx.hbrBackground = (HBRUSH)COLOR_BTNSHADOW;
WndClsEx.lpszClassName = _T("Trackbar_Tester");
WndClsEx.hInstance = hInstance;
RegisterClassEx(&WndClsEx);
InitCommonControlsEx( &icc );
if( !(hWin = CreateWindow( WndClsEx.lpszClassName, _T("TB_Tester"), WS_OVERLAPPEDWINDOW, 0, 0, 600, 400, NULL, NULL, hInstance, NULL )) )
return 0;
ShowWindow( hWin, SW_SHOWNORMAL );
UpdateWindow( hWin );
while( GetMessage(&Msg, NULL, 0, 0) ) {
TranslateMessage( &Msg );
DispatchMessage( &Msg );
}
return (int)Msg.wParam;
}
That's the whole program.
I give a compact example.
If you run it, you will see the problem.
If you comment the new controls, the problem will disappear.