Skip to content

Commit 364ebda

Browse files
committed
Improved compatibility to newer versions of Visual C++.
1 parent 71bfb02 commit 364ebda

File tree

8 files changed

+61
-61
lines changed

8 files changed

+61
-61
lines changed

samples/WTL10/General/Drag'n'Drop/MainDlg.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,11 @@ void __stdcall CMainDlg::DropTabstripu(LPDISPATCH /*dropTarget*/, short /*button
196196
_variant_t v;
197197
v.Clear();
198198
while(pEnum->Next(1, &v, &ul) == S_OK) {
199-
CComQIPtr<ITabStripTab> pTab = v.pdispVal;
200-
if(pTab->GetIndex() < insertAt) {
201-
pTab->PutIndex(insertAt - 1);
199+
CComQIPtr<ITabStripTab> pTab2 = v.pdispVal;
200+
if(pTab2->GetIndex() < insertAt) {
201+
pTab2->PutIndex(insertAt - 1);
202202
} else {
203-
pTab->PutIndex(insertAt);
203+
pTab2->PutIndex(insertAt);
204204
insertAt++;
205205
}
206206
}

src/SourceOLEDataObject.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ STDMETHODIMP SourceOLEDataObject::GetCanonicalFormat(LONG* pFormatID, LONG* pInd
714714
*pFormatID = RegisterClipboardFormat(CF_RTF);
715715
}
716716

717-
FORMATETC format = {static_cast<CLIPFORMAT>(*pFormatID), NULL, *pDataOrViewAspect, *pIndex, 0};
717+
FORMATETC format = {static_cast<CLIPFORMAT>(*pFormatID), NULL, static_cast<DWORD>(*pDataOrViewAspect), *pIndex, 0};
718718
switch(*pFormatID) {
719719
case CF_BITMAP:
720720
case CF_PALETTE:
@@ -760,7 +760,7 @@ STDMETHODIMP SourceOLEDataObject::GetData(LONG formatID, LONG index/* = -1*/, LO
760760
formatID = RegisterClipboardFormat(CF_RTF);
761761
}
762762

763-
FORMATETC format = {static_cast<CLIPFORMAT>(formatID), NULL, dataOrViewAspect, index, 0};
763+
FORMATETC format = {static_cast<CLIPFORMAT>(formatID), NULL, static_cast<DWORD>(dataOrViewAspect), index, 0};
764764
switch(formatID) {
765765
case CF_BITMAP:
766766
case CF_PALETTE:
@@ -1002,7 +1002,7 @@ STDMETHODIMP SourceOLEDataObject::GetFormat(LONG formatID, LONG index/* = -1*/,
10021002
}
10031003

10041004
*pFormatAvailable = VARIANT_FALSE;
1005-
FORMATETC format = {static_cast<CLIPFORMAT>(formatID), NULL, dataOrViewAspect, index, 0};
1005+
FORMATETC format = {static_cast<CLIPFORMAT>(formatID), NULL, static_cast<DWORD>(dataOrViewAspect), index, 0};
10061006
switch(formatID) {
10071007
case CF_BITMAP:
10081008
case CF_PALETTE:
@@ -1032,7 +1032,7 @@ STDMETHODIMP SourceOLEDataObject::SetData(LONG formatID, VARIANT data/* = _varia
10321032
formatID = RegisterClipboardFormat(CF_RTF);
10331033
}
10341034

1035-
FORMATETC format = {static_cast<CLIPFORMAT>(formatID), NULL, dataOrViewAspect, index, 0};
1035+
FORMATETC format = {static_cast<CLIPFORMAT>(formatID), NULL, static_cast<DWORD>(dataOrViewAspect), index, 0};
10361036
STGMEDIUM storageMedium = {0};
10371037

10381038
switch(format.cfFormat) {

src/TabStrip.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,9 +1084,9 @@ BOOL TabStrip::CreateLegacyOLEDragImage(ITabStripTabContainer* pTabs, LPSHDRAGIM
10841084
}
10851085
ATLASSUME(pImgLst);
10861086

1087-
DWORD flags = 0;
1088-
pImgLst->GetItemFlags(0, &flags);
1089-
if(flags & ILIF_ALPHA) {
1087+
DWORD imageFlags = 0;
1088+
pImgLst->GetItemFlags(0, &imageFlags);
1089+
if(imageFlags & ILIF_ALPHA) {
10901090
// the drag image makes use of the alpha channel
10911091
IMAGEINFO imageInfo = {0};
10921092
ImageList_GetImageInfo(hImageList, 0, &imageInfo);
@@ -4547,11 +4547,11 @@ STDMETHODIMP TabStrip::HitTest(OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestCons
45474547
}
45484548

45494549
if(IsWindow()) {
4550-
UINT flags = static_cast<UINT>(*pHitTestDetails);
4551-
int tabIndex = HitTest(x, y, &flags, TRUE);
4550+
UINT hitTestFlags = static_cast<UINT>(*pHitTestDetails);
4551+
int tabIndex = HitTest(x, y, &hitTestFlags, TRUE);
45524552

45534553
if(pHitTestDetails) {
4554-
*pHitTestDetails = static_cast<HitTestConstants>(flags);
4554+
*pHitTestDetails = static_cast<HitTestConstants>(hitTestFlags);
45554555
}
45564556
ClassFactory::InitTabStripTab(tabIndex, this, IID_ITabStripTab, reinterpret_cast<LPUNKNOWN*>(ppHitTab));
45574557
return S_OK;
@@ -8426,11 +8426,11 @@ int TabStrip::HitTest(LONG x, LONG y, UINT* pFlags, BOOL ignoreBoundingBoxDefini
84268426
{
84278427
ATLASSERT(IsWindow());
84288428

8429-
UINT flags = 0;
8429+
UINT hitTestFlags = 0;
84308430
if(pFlags) {
8431-
flags = *pFlags;
8431+
hitTestFlags = *pFlags;
84328432
}
8433-
TCHITTESTINFO hitTestInfo = {{x, y}, flags};
8433+
TCHITTESTINFO hitTestInfo = {{x, y}, hitTestFlags };
84348434
int tabIndex = SendMessage(TCM_HITTEST, 0, reinterpret_cast<LPARAM>(&hitTestInfo));
84358435

84368436
if(tabIndex == -1) {
@@ -8476,11 +8476,11 @@ int TabStrip::HitTest(LONG x, LONG y, UINT* pFlags, BOOL ignoreBoundingBoxDefini
84768476
}
84778477
}
84788478

8479-
flags = hitTestInfo.flags;
8479+
hitTestFlags = hitTestInfo.flags;
84808480
if(pFlags) {
8481-
*pFlags = flags;
8481+
*pFlags = hitTestFlags;
84828482
}
8483-
if(!ignoreBoundingBoxDefinition && ((properties.tabBoundingBoxDefinition & flags) != flags)) {
8483+
if(!ignoreBoundingBoxDefinition && ((properties.tabBoundingBoxDefinition & hitTestFlags) != hitTestFlags)) {
84848484
tabIndex = -1;
84858485
}
84868486
return tabIndex;

src/TabStrip.h

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5672,10 +5672,10 @@ class ATL_NO_VTABLE TabStrip :
56725672
this->pDraggedTabs->Release();
56735673
this->pDraggedTabs = NULL;
56745674
}
5675-
if(hDragImageList && autoDestroyImgLst) {
5676-
ImageList_Destroy(hDragImageList);
5675+
if(this->hDragImageList && autoDestroyImgLst) {
5676+
ImageList_Destroy(this->hDragImageList);
56775677
}
5678-
hDragImageList = NULL;
5678+
this->hDragImageList = NULL;
56795679
autoDestroyImgLst = FALSE;
56805680
dragImageIsHidden = 1;
56815681
lastDropTarget = -1;
@@ -5699,7 +5699,7 @@ class ATL_NO_VTABLE TabStrip :
56995699
/// \sa dragImageIsHidden, HideDragImage, IsDragImageVisible
57005700
void ShowDragImage(BOOL commonDragDropOnly)
57015701
{
5702-
if(hDragImageList) {
5702+
if(this->hDragImageList) {
57035703
--dragImageIsHidden;
57045704
if(dragImageIsHidden == 0) {
57055705
ImageList_DragShowNolock(TRUE);
@@ -5720,7 +5720,7 @@ class ATL_NO_VTABLE TabStrip :
57205720
/// \sa dragImageIsHidden, ShowDragImage, IsDragImageVisible
57215721
void HideDragImage(BOOL commonDragDropOnly)
57225722
{
5723-
if(hDragImageList) {
5723+
if(this->hDragImageList) {
57245724
++dragImageIsHidden;
57255725
if(dragImageIsHidden == 1) {
57265726
ImageList_DragShowNolock(FALSE);
@@ -5747,47 +5747,47 @@ class ATL_NO_VTABLE TabStrip :
57475747
///
57485748
/// \param[in] hWndTabStrip The tabstrip window, that the method will work on to calculate the position
57495749
/// of the drag image's hotspot.
5750-
/// \param[in] pDraggedTabs The \c ITabStripTabContainer implementation of the collection of
5750+
/// \param[in] pDraggedTbs The \c ITabStripTabContainer implementation of the collection of
57515751
/// the dragged tabs.
5752-
/// \param[in] hDragImageList The imagelist containing the drag image that shall be used to
5752+
/// \param[in] hDragImgLst The imagelist containing the drag image that shall be used to
57535753
/// visualize the drag'n'drop operation. If -1, the method will create the drag image
57545754
/// itself; if \c NULL, no drag image will be displayed.
57555755
/// \param[in,out] pXHotSpot The x-coordinate (in pixels) of the drag image's hotspot relative to the
5756-
/// drag image's upper-left corner. If the \c hDragImageList parameter is set to
5757-
/// \c NULL, this parameter is ignored. If the \c hDragImageList parameter is set to
5756+
/// drag image's upper-left corner. If the \c hDragImgLst parameter is set to
5757+
/// \c NULL, this parameter is ignored. If the \c hDragImgLst parameter is set to
57585758
/// -1, this parameter is set to the hotspot calculated by the method.
57595759
/// \param[in,out] pYHotSpot The y-coordinate (in pixels) of the drag image's hotspot relative to the
5760-
/// drag image's upper-left corner. If the \c hDragImageList parameter is set to
5761-
/// \c NULL, this parameter is ignored. If the \c hDragImageList parameter is set to
5760+
/// drag image's upper-left corner. If the \c hDragImgLst parameter is set to
5761+
/// \c NULL, this parameter is ignored. If the \c hDragImgLst parameter is set to
57625762
/// -1, this parameter is set to the hotspot calculated by the method.
57635763
///
57645764
/// \return An \c HRESULT error code.
57655765
///
57665766
/// \sa EndDrag
5767-
HRESULT BeginDrag(HWND hWndTabStrip, ITabStripTabContainer* pDraggedTabs, HIMAGELIST hDragImageList, PINT pXHotSpot, PINT pYHotSpot)
5767+
HRESULT BeginDrag(HWND hWndTabStrip, ITabStripTabContainer* pDraggedTbs, HIMAGELIST hDragImgLst, PINT pXHotSpot, PINT pYHotSpot)
57685768
{
5769-
ATLASSUME(pDraggedTabs);
5770-
if(!pDraggedTabs) {
5769+
ATLASSUME(pDraggedTbs);
5770+
if(!pDraggedTbs) {
57715771
return E_INVALIDARG;
57725772
}
57735773

57745774
UINT b = FALSE;
5775-
if(hDragImageList == static_cast<HIMAGELIST>(LongToHandle(-1))) {
5775+
if(hDragImgLst == static_cast<HIMAGELIST>(LongToHandle(-1))) {
57765776
OLE_HANDLE h = NULL;
57775777
OLE_XPOS_PIXELS xUpperLeft = 0;
57785778
OLE_YPOS_PIXELS yUpperLeft = 0;
5779-
if(FAILED(pDraggedTabs->CreateDragImage(&xUpperLeft, &yUpperLeft, &h))) {
5779+
if(FAILED(pDraggedTbs->CreateDragImage(&xUpperLeft, &yUpperLeft, &h))) {
57805780
return E_FAIL;
57815781
}
5782-
hDragImageList = static_cast<HIMAGELIST>(LongToHandle(h));
5782+
hDragImgLst = static_cast<HIMAGELIST>(LongToHandle(h));
57835783
b = TRUE;
57845784

57855785
DWORD position = GetMessagePos();
57865786
POINT mousePosition = {GET_X_LPARAM(position), GET_Y_LPARAM(position)};
57875787
::ScreenToClient(hWndTabStrip, &mousePosition);
57885788
if(CWindow(hWndTabStrip).GetExStyle() & WS_EX_LAYOUTRTL) {
57895789
SIZE dragImageSize = {0};
5790-
ImageList_GetIconSize(hDragImageList, reinterpret_cast<PINT>(&dragImageSize.cx), reinterpret_cast<PINT>(&dragImageSize.cy));
5790+
ImageList_GetIconSize(hDragImgLst, reinterpret_cast<PINT>(&dragImageSize.cx), reinterpret_cast<PINT>(&dragImageSize.cy));
57915791
*pXHotSpot = xUpperLeft + dragImageSize.cx - mousePosition.x;
57925792
} else {
57935793
*pXHotSpot = mousePosition.x - xUpperLeft;
@@ -5800,12 +5800,12 @@ class ATL_NO_VTABLE TabStrip :
58005800
}
58015801

58025802
this->autoDestroyImgLst = b;
5803-
this->hDragImageList = hDragImageList;
5803+
this->hDragImageList = hDragImgLst;
58045804
if(this->pDraggedTabs) {
58055805
this->pDraggedTabs->Release();
58065806
this->pDraggedTabs = NULL;
58075807
}
5808-
pDraggedTabs->Clone(&this->pDraggedTabs);
5808+
pDraggedTbs->Clone(&this->pDraggedTabs);
58095809
ATLASSUME(this->pDraggedTabs);
58105810
this->lastDropTarget = -1;
58115811

@@ -5819,14 +5819,14 @@ class ATL_NO_VTABLE TabStrip :
58195819
/// \sa BeginDrag
58205820
void EndDrag(void)
58215821
{
5822-
if(pDraggedTabs) {
5823-
pDraggedTabs->Release();
5824-
pDraggedTabs = NULL;
5822+
if(this->pDraggedTabs) {
5823+
this->pDraggedTabs->Release();
5824+
this->pDraggedTabs = NULL;
58255825
}
5826-
if(autoDestroyImgLst && hDragImageList) {
5827-
ImageList_Destroy(hDragImageList);
5826+
if(autoDestroyImgLst && this->hDragImageList) {
5827+
ImageList_Destroy(this->hDragImageList);
58285828
}
5829-
hDragImageList = NULL;
5829+
this->hDragImageList = NULL;
58305830
dragImageIsHidden = 1;
58315831
lastDropTarget = -1;
58325832
autoScrolling.Reset();
@@ -5839,7 +5839,7 @@ class ATL_NO_VTABLE TabStrip :
58395839
/// \sa BeginDrag, EndDrag
58405840
BOOL IsDragging(void)
58415841
{
5842-
return (pDraggedTabs != NULL);
5842+
return (this->pDraggedTabs != NULL);
58435843
}
58445844

58455845
/// \brief <em>Performs any tasks that must be done if \c IDropTarget::DragEnter is called</em>

src/TabStripCtl.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
<SmallerTypeCheck>true</SmallerTypeCheck>
168168
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
169169
<BufferSecurityCheck>true</BufferSecurityCheck>
170-
<FunctionLevelLinking>false</FunctionLevelLinking>
170+
<FunctionLevelLinking>true</FunctionLevelLinking>
171171
<DisableLanguageExtensions>false</DisableLanguageExtensions>
172172
<AdditionalOptions>
173173
</AdditionalOptions>
@@ -351,7 +351,7 @@
351351
<SmallerTypeCheck>true</SmallerTypeCheck>
352352
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
353353
<BufferSecurityCheck>true</BufferSecurityCheck>
354-
<FunctionLevelLinking>false</FunctionLevelLinking>
354+
<FunctionLevelLinking>true</FunctionLevelLinking>
355355
<DisableLanguageExtensions>false</DisableLanguageExtensions>
356356
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
357357
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>

src/TabStripTabContainer.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,19 @@ STDMETHODIMP TabStripTabContainer::get__NewEnum(IUnknown** ppEnumerator)
216216
}
217217

218218

219-
STDMETHODIMP TabStripTabContainer::Add(VARIANT tabs)
219+
STDMETHODIMP TabStripTabContainer::Add(VARIANT tabsToAdd)
220220
{
221221
HRESULT hr = E_FAIL;
222222
LONG id = -1;
223-
switch(tabs.vt) {
223+
switch(tabsToAdd.vt) {
224224
case VT_DISPATCH:
225-
if(tabs.pdispVal) {
226-
CComQIPtr<ITabStripTab, &IID_ITabStripTab> pTSTab = tabs.pdispVal;
225+
if(tabsToAdd.pdispVal) {
226+
CComQIPtr<ITabStripTab, &IID_ITabStripTab> pTSTab = tabsToAdd.pdispVal;
227227
if(pTSTab) {
228228
// add a single TabStripTab object
229229
hr = pTSTab->get_ID(&id);
230230
} else {
231-
CComQIPtr<ITabStripTabs, &IID_ITabStripTabs> pTSTabs(tabs.pdispVal);
231+
CComQIPtr<ITabStripTabs, &IID_ITabStripTabs> pTSTabs(tabsToAdd.pdispVal);
232232
if(pTSTabs) {
233233
// add a TabStripTabs collection
234234
CComQIPtr<IEnumVARIANT, &IID_IEnumVARIANT> pEnumerator(pTSTabs);
@@ -276,7 +276,7 @@ STDMETHODIMP TabStripTabContainer::Add(VARIANT tabs)
276276
default:
277277
VARIANT v;
278278
VariantInit(&v);
279-
hr = VariantChangeType(&v, &tabs, 0, VT_UI4);
279+
hr = VariantChangeType(&v, &tabsToAdd, 0, VT_UI4);
280280
id = v.ulVal;
281281
break;
282282
}

src/TabStripTabContainer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,13 @@ class ATL_NO_VTABLE TabStripTabContainer :
187187

188188
/// \brief <em>Adds the specified tab(s) to the collection</em>
189189
///
190-
/// \param[in] tabs The tab(s) to add. May be either a tab ID, a \c TabStripTab object or a
190+
/// \param[in] tabsToAdd The tab(s) to add. May be either a tab ID, a \c TabStripTab object or a
191191
/// \c TabStripTabs collection.
192192
///
193193
/// \return An \c HRESULT error code.
194194
///
195195
/// \sa TabStripTab::get_ID, Count, Remove, RemoveAll
196-
virtual HRESULT STDMETHODCALLTYPE Add(VARIANT tabs);
196+
virtual HRESULT STDMETHODCALLTYPE Add(VARIANT tabsToAdd);
197197
/// \brief <em>Clones the collection object</em>
198198
///
199199
/// Retrieves an exact copy of the collection.

src/TargetOLEDataObject.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ STDMETHODIMP TargetOLEDataObject::GetCanonicalFormat(LONG* pFormatID, LONG* pInd
7373
*pFormatID = RegisterClipboardFormat(CF_RTF);
7474
}
7575

76-
FORMATETC format = {static_cast<CLIPFORMAT>(*pFormatID), NULL, *pDataOrViewAspect, *pIndex, 0};
76+
FORMATETC format = {static_cast<CLIPFORMAT>(*pFormatID), NULL, static_cast<DWORD>(*pDataOrViewAspect), *pIndex, 0};
7777
switch(*pFormatID) {
7878
case CF_BITMAP:
7979
case CF_PALETTE:
@@ -120,7 +120,7 @@ STDMETHODIMP TargetOLEDataObject::GetData(LONG formatID, LONG index/* = -1*/, LO
120120
}
121121

122122
if(properties.pDataObject) {
123-
FORMATETC format = {static_cast<CLIPFORMAT>(formatID), NULL, dataOrViewAspect, index, 0};
123+
FORMATETC format = {static_cast<CLIPFORMAT>(formatID), NULL, static_cast<DWORD>(dataOrViewAspect), index, 0};
124124
switch(formatID) {
125125
case CF_BITMAP:
126126
case CF_PALETTE:
@@ -372,7 +372,7 @@ STDMETHODIMP TargetOLEDataObject::GetFormat(LONG formatID, LONG index/* = -1*/,
372372

373373
*pFormatAvailable = VARIANT_FALSE;
374374
if(properties.pDataObject) {
375-
FORMATETC format = {static_cast<CLIPFORMAT>(formatID), NULL, dataOrViewAspect, index, 0};
375+
FORMATETC format = {static_cast<CLIPFORMAT>(formatID), NULL, static_cast<DWORD>(dataOrViewAspect), index, 0};
376376
switch(formatID) {
377377
case CF_BITMAP:
378378
case CF_PALETTE:
@@ -412,7 +412,7 @@ STDMETHODIMP TargetOLEDataObject::SetData(LONG formatID, VARIANT data/* = _varia
412412
if(properties.pDataObject) {
413413
// transform the data into a FORMATETC/STGMEDIUM pair
414414
STGMEDIUM storageMedium = {0};
415-
FORMATETC format = {static_cast<CLIPFORMAT>(formatID), NULL, dataOrViewAspect, index, 0};
415+
FORMATETC format = {static_cast<CLIPFORMAT>(formatID), NULL, static_cast<DWORD>(dataOrViewAspect), index, 0};
416416
switch(format.cfFormat) {
417417
case CF_HDROP: {
418418
// the global memory must contain a pointer to an array of DROPFILES structs

0 commit comments

Comments
 (0)