avoid x64 pointer issues, leading to crash on tab resorting

This commit is contained in:
Christian Grasser 2015-06-08 09:07:41 +02:00
parent 73dee04dea
commit 6ec31f4f85

View File

@ -152,7 +152,7 @@ void TabBar::activateAt(int index) const
TBHDR nmhdr; TBHDR nmhdr;
nmhdr.hdr.hwndFrom = _hSelf; nmhdr.hdr.hwndFrom = _hSelf;
nmhdr.hdr.code = TCN_SELCHANGE; nmhdr.hdr.code = TCN_SELCHANGE;
nmhdr.hdr.idFrom = reinterpret_cast<unsigned int>(this); nmhdr.hdr.idFrom = reinterpret_cast<UINT_PTR>(this);
nmhdr.tabOrigin = index; nmhdr.tabOrigin = index;
} }
@ -339,7 +339,7 @@ void TabBarPlus::doOwnerDrawTab()
{ {
if (_hwndArray[i]) if (_hwndArray[i])
{ {
DWORD style = ::GetWindowLongPtr(_hwndArray[i], GWL_STYLE); LONG_PTR style = ::GetWindowLongPtr(_hwndArray[i], GWL_STYLE);
if (isOwnerDrawTab()) if (isOwnerDrawTab())
style |= TCS_OWNERDRAWFIXED; style |= TCS_OWNERDRAWFIXED;
else else
@ -405,9 +405,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
// Custom window message to change tab control style on the fly // Custom window message to change tab control style on the fly
case WM_TABSETSTYLE: case WM_TABSETSTYLE:
{ {
DWORD style; LONG_PTR style = ::GetWindowLongPtr(hwnd, GWL_STYLE);
//::SendMessage(upDownWnd, UDM_SETBUDDY, NULL, 0);
style = ::GetWindowLongPtr(hwnd, GWL_STYLE);
if (wParam > 0) if (wParam > 0)
style |= lParam; style |= lParam;
@ -463,7 +461,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
TBHDR nmhdr; TBHDR nmhdr;
nmhdr.hdr.hwndFrom = _hSelf; nmhdr.hdr.hwndFrom = _hSelf;
nmhdr.hdr.code = NM_CLICK; nmhdr.hdr.code = NM_CLICK;
nmhdr.hdr.idFrom = reinterpret_cast<unsigned int>(this); nmhdr.hdr.idFrom = reinterpret_cast<UINT_PTR>(this);
nmhdr.tabOrigin = currentTabOn; nmhdr.tabOrigin = currentTabOn;
::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&nmhdr)); ::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&nmhdr));
@ -558,7 +556,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
TBHDR nmhdr; TBHDR nmhdr;
nmhdr.hdr.hwndFrom = _hSelf; nmhdr.hdr.hwndFrom = _hSelf;
nmhdr.hdr.code = _isDraggingInside?TCN_TABDROPPED:TCN_TABDROPPEDOUTSIDE; nmhdr.hdr.code = _isDraggingInside?TCN_TABDROPPED:TCN_TABDROPPEDOUTSIDE;
nmhdr.hdr.idFrom = reinterpret_cast<unsigned int>(this); nmhdr.hdr.idFrom = reinterpret_cast<UINT_PTR>(this);
nmhdr.tabOrigin = currentTabOn; nmhdr.tabOrigin = currentTabOn;
::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&nmhdr)); ::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&nmhdr));
@ -572,7 +570,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
TBHDR nmhdr; TBHDR nmhdr;
nmhdr.hdr.hwndFrom = _hSelf; nmhdr.hdr.hwndFrom = _hSelf;
nmhdr.hdr.code = TCN_TABDELETE; nmhdr.hdr.code = TCN_TABDELETE;
nmhdr.hdr.idFrom = reinterpret_cast<unsigned int>(this); nmhdr.hdr.idFrom = reinterpret_cast<UINT_PTR>(this);
nmhdr.tabOrigin = currentTabOn; nmhdr.tabOrigin = currentTabOn;
::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&nmhdr)); ::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&nmhdr));
@ -617,7 +615,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
TBHDR nmhdr; TBHDR nmhdr;
nmhdr.hdr.hwndFrom = _hSelf; nmhdr.hdr.hwndFrom = _hSelf;
nmhdr.hdr.code = TCN_TABDELETE; nmhdr.hdr.code = TCN_TABDELETE;
nmhdr.hdr.idFrom = reinterpret_cast<unsigned int>(this); nmhdr.hdr.idFrom = reinterpret_cast<UINT_PTR>(this);
nmhdr.tabOrigin = currentTabOn; nmhdr.tabOrigin = currentTabOn;
::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&nmhdr)); ::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&nmhdr));
@ -634,7 +632,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
TBHDR nmhdr; TBHDR nmhdr;
nmhdr.hdr.hwndFrom = _hSelf; nmhdr.hdr.hwndFrom = _hSelf;
nmhdr.hdr.code = TCN_TABDELETE; nmhdr.hdr.code = TCN_TABDELETE;
nmhdr.hdr.idFrom = reinterpret_cast<unsigned int>(this); nmhdr.hdr.idFrom = reinterpret_cast<UINT_PTR>(this);
nmhdr.tabOrigin = currentTabOn; nmhdr.tabOrigin = currentTabOn;
::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&nmhdr)); ::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&nmhdr));