diff --git a/src/msw/headerctrl.cpp b/src/msw/headerctrl.cpp index 1fdebf74d8..359324b439 100644 --- a/src/msw/headerctrl.cpp +++ b/src/msw/headerctrl.cpp @@ -90,7 +90,7 @@ bool wxHeaderCtrl::Create(wxWindow *parent, // use 0 here but this starts to look ugly) if ( wxApp::GetComCtl32Version() >= 600 ) { - Header_SetBitmapMargin(GetHwnd(), ::GetSystemMetrics(SM_CXEDGE)); + (void)Header_SetBitmapMargin(GetHwnd(), ::GetSystemMetrics(SM_CXEDGE)); } return true; @@ -237,7 +237,8 @@ void wxHeaderCtrl::DoUpdate(unsigned int idx) if ( !m_isHidden[idx] ) { // but it wasn't hidden before, so remove it - Header_DeleteItem(GetHwnd(), MSWToNativeIdx(idx)); + if ( !Header_DeleteItem(GetHwnd(), MSWToNativeIdx(idx)) ) + wxLogLastError(wxS("Header_DeleteItem()")); m_isHidden[idx] = true; } @@ -252,7 +253,8 @@ void wxHeaderCtrl::DoUpdate(unsigned int idx) else // and it was shown before as well { // we need to remove the old column - Header_DeleteItem(GetHwnd(), MSWToNativeIdx(idx)); + if ( !Header_DeleteItem(GetHwnd(), MSWToNativeIdx(idx)) ) + wxLogLastError(wxS("Header_DeleteItem()")); } DoInsertItem(col, idx); diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index b5f6abd6f6..29f9986bf0 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -519,8 +519,10 @@ bool wxListCtrl::SetBackgroundColour(const wxColour& col) // we set the same colour for both the "empty" background and the items // background COLORREF color = wxColourToRGB(col); - ListView_SetBkColor(GetHwnd(), color); - ListView_SetTextBkColor(GetHwnd(), color); + if ( !ListView_SetBkColor(GetHwnd(), color) ) + wxLogLastError(wxS("ListView_SetBkColor()")); + if ( !ListView_SetTextBkColor(GetHwnd(), color) ) + wxLogLastError(wxS("ListView_SetTextBkColor()")); return true; } @@ -936,7 +938,7 @@ bool wxListCtrl::SetItemState(long item, long state, long stateMask) // to, so do it explicitly if ( changingFocus && !HasFlag(wxLC_SINGLE_SEL) ) { - ListView_SetSelectionMark(GetHwnd(), item); + (void)ListView_SetSelectionMark(GetHwnd(), item); } return true; @@ -1225,7 +1227,8 @@ wxColour wxListCtrl::GetTextColour() const // Sets the text colour of the listview void wxListCtrl::SetTextColour(const wxColour& col) { - ListView_SetTextColor(GetHwnd(), wxColourToPalRGB(col)); + if ( !ListView_SetTextColor(GetHwnd(), wxColourToPalRGB(col)) ) + wxLogLastError(wxS("ListView_SetTextColor()")); } // Gets the index of the topmost visible item when in @@ -2656,7 +2659,8 @@ bool HandleSubItemPrepaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont, int colCount) it.iSubItem = col; it.pszText = text; it.cchTextMax = WXSIZEOF(text); - ListView_GetItem(hwndList, &it); + if ( !ListView_GetItem(hwndList, &it) ) + return false; HIMAGELIST himl = ListView_GetImageList(hwndList, LVSIL_SMALL); if ( himl && ImageList_GetImageCount(himl) ) @@ -3086,7 +3090,8 @@ void wxListCtrl::RefreshItem(long item) void wxListCtrl::RefreshItems(long itemFrom, long itemTo) { - ListView_RedrawItems(GetHwnd(), itemFrom, itemTo); + if ( !ListView_RedrawItems(GetHwnd(), itemFrom, itemTo) ) + wxLogLastError(wxS("ListView_RedrawItems")); } // ---------------------------------------------------------------------------- diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index b3f42c5118..68a6ef46c9 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -360,7 +360,7 @@ int wxNotebook::SetSelection(size_t nPage) UpdateSelection(nPage); - TabCtrl_SetCurSel(GetHwnd(), nPage); + (void)TabCtrl_SetCurSel(GetHwnd(), nPage); SendPageChangedEvent(selectionOld, nPage); } @@ -406,7 +406,7 @@ int wxNotebook::ChangeSelection(size_t nPage) if ( m_selection == wxNOT_FOUND || nPage != (size_t)m_selection ) { - TabCtrl_SetCurSel(GetHwnd(), nPage); + (void)TabCtrl_SetCurSel(GetHwnd(), nPage); UpdateSelection(nPage); } @@ -508,7 +508,7 @@ wxRect wxNotebook::GetPageSize() const // The value of 20 is chosen arbitrarily but seems to work if ( rc.right > 20 && rc.bottom > 20 ) { - TabCtrl_AdjustRect(GetHwnd(), false, &rc); + (void)TabCtrl_AdjustRect(GetHwnd(), false, &rc); wxCopyRECTToRect(rc, r); } @@ -525,7 +525,7 @@ void wxNotebook::SetPageSize(const wxSize& size) rc.right = size.x; rc.bottom = size.y; - TabCtrl_AdjustRect(GetHwnd(), true, &rc); + (void)TabCtrl_AdjustRect(GetHwnd(), true, &rc); // and now set it SetSize(rc.right - rc.left, rc.bottom - rc.top); @@ -552,9 +552,11 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const if ( GetPageCount() > 0 ) { RECT rect; - TabCtrl_GetItemRect(GetHwnd(), 0, &rect); - tabSize.x = rect.right - rect.left; - tabSize.y = rect.bottom - rect.top; + if ( TabCtrl_GetItemRect(GetHwnd(), 0, &rect) ) + { + tabSize.x = rect.right - rect.left; + tabSize.y = rect.bottom - rect.top; + } } const int rows = GetRowCount(); @@ -601,7 +603,8 @@ wxNotebookPage *wxNotebook::DoRemovePage(size_t nPage) // selected page is visible and others are hidden: pageRemoved->Show(false); - TabCtrl_DeleteItem(GetHwnd(), nPage); + if ( !TabCtrl_DeleteItem(GetHwnd(), nPage) ) + wxLogLastError(wxS("TabCtrl_DeleteItem()")); if ( m_pages.IsEmpty() ) { @@ -654,7 +657,8 @@ bool wxNotebook::DeleteAllPages() m_pages.Clear(); - TabCtrl_DeleteAllItems(GetHwnd()); + if ( !TabCtrl_DeleteAllItems(GetHwnd()) ) + wxLogLastError(wxS("TabCtrl_DeleteAllItems()")); m_selection = wxNOT_FOUND; @@ -986,7 +990,7 @@ void wxNotebook::OnSize(wxSizeEvent& event) UpdateBgBrush(); #endif // wxUSE_UXTHEME - TabCtrl_AdjustRect(GetHwnd(), false, &rc); + (void)TabCtrl_AdjustRect(GetHwnd(), false, &rc); int width = rc.right - rc.left, height = rc.bottom - rc.top; diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 8bc7a6ac09..cf59c7bc03 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -340,11 +340,11 @@ static bool SetFocus(HWND hwndTV, HTREEITEM htItem) // prevent the tree from unselecting the old focus which it // would do by default (TreeView_SelectItem unselects the // focused item) - TreeView_SelectItem(hwndTV, 0); + (void)TreeView_SelectItem(hwndTV, 0); SelectItem(hwndTV, htFocus); } - TreeView_SelectItem(hwndTV, htItem); + (void)TreeView_SelectItem(hwndTV, htItem); if ( !wasSelected ) { @@ -359,7 +359,7 @@ static bool SetFocus(HWND hwndTV, HTREEITEM htItem) bool wasFocusSelected = IsItemSelected(hwndTV, htFocus); // just clear the focus - TreeView_SelectItem(hwndTV, 0); + (void)TreeView_SelectItem(hwndTV, 0); if ( wasFocusSelected ) { @@ -873,7 +873,7 @@ unsigned int wxTreeCtrl::GetIndent() const void wxTreeCtrl::SetIndent(unsigned int indent) { - TreeView_SetIndent(GetHwnd(), indent); + (void)TreeView_SetIndent(GetHwnd(), indent); } void wxTreeCtrl::SetAnyImageList(wxImageList *imageList, int which) @@ -1969,7 +1969,7 @@ void wxTreeCtrl::EnsureVisible(const wxTreeItemId& item) wxCHECK_RET( !IsHiddenRoot(item), wxT("can't show hidden root item") ); // no error return - TreeView_EnsureVisible(GetHwnd(), HITEM(item)); + (void)TreeView_EnsureVisible(GetHwnd(), HITEM(item)); } void wxTreeCtrl::ScrollTo(const wxTreeItemId& item) @@ -2031,7 +2031,8 @@ wxTextCtrl *wxTreeCtrl::EditLabel(const wxTreeItemId& item, // End label editing, optionally cancelling the edit void wxTreeCtrl::DoEndEditLabel(bool discardChanges) { - TreeView_EndEditLabelNow(GetHwnd(), discardChanges); + if ( !TreeView_EndEditLabelNow(GetHwnd(), discardChanges) ) + wxLogLastError(wxS("TreeView_EndEditLabelNow()")); DeleteTextCtrl(); } @@ -2170,7 +2171,8 @@ void wxTreeCtrl::SortChildren(const wxTreeItemId& item) // OnCompareItems if ( GetClassInfo() == wxCLASSINFO(wxTreeCtrl) ) { - TreeView_SortChildren(GetHwnd(), HITEM(item), 0); + if ( !TreeView_SortChildren(GetHwnd(), HITEM(item), 0) ) + wxLogLastError(wxS("TreeView_SortChildren()")); } else { @@ -2178,7 +2180,8 @@ void wxTreeCtrl::SortChildren(const wxTreeItemId& item) tvSort.hParent = HITEM(item); tvSort.lpfnCompare = wxTreeSortHelper::Compare; tvSort.lParam = (LPARAM)this; - TreeView_SortChildrenCB(GetHwnd(), &tvSort, 0 /* reserved */); + if ( !TreeView_SortChildrenCB(GetHwnd(), &tvSort, 0 /* reserved */) ) + wxLogLastError(wxS("TreeView_SortChildrenCB()")); } } @@ -2996,25 +2999,26 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) tviAux.hItem = HITEM(m_htClickedItem); tviAux.mask = TVIF_STATE | TVIF_PARAM; tviAux.stateMask = 0xffffffff; - TreeView_GetItem(GetHwnd(), &tviAux); + if ( TreeView_GetItem(GetHwnd(), &tviAux) ) + { + tv.itemNew.state = tviAux.state; + tv.itemNew.lParam = tviAux.lParam; - tv.itemNew.state = tviAux.state; - tv.itemNew.lParam = tviAux.lParam; + tv.ptDrag.x = x; + tv.ptDrag.y = y; - tv.ptDrag.x = x; - tv.ptDrag.y = y; + // do it before SendMessage() call below to avoid + // reentrancies here if there is another WM_MOUSEMOVE + // in the queue already + m_htClickedItem.Unset(); - // do it before SendMessage() call below to avoid - // reentrancies here if there is another WM_MOUSEMOVE - // in the queue already - m_htClickedItem.Unset(); + ::SendMessage(GetHwndOf(GetParent()), WM_NOTIFY, + tv.hdr.idFrom, (LPARAM)&tv ); - ::SendMessage(GetHwndOf(GetParent()), WM_NOTIFY, - tv.hdr.idFrom, (LPARAM)&tv ); - - // don't pass it to the default window proc, it would - // start dragging again - processed = true; + // don't pass it to the default window proc, it would + // start dragging again + processed = true; + } } } #endif // __WXWINCE__ @@ -3028,7 +3032,8 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) // highlight the item as target (hiding drag image is // necessary - otherwise the display will be corrupted) m_dragImage->Hide(); - TreeView_SelectDropTarget(GetHwnd(), htItem); + if ( !TreeView_SelectDropTarget(GetHwnd(), htItem) ) + wxLogLastError(wxS("TreeView_SelectDropTarget()")); m_dragImage->Show(); } } @@ -3101,7 +3106,8 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) // if we don't do it, the tree seems to think that 2 items // are selected simultaneously which is quite weird - TreeView_SelectDropTarget(GetHwnd(), 0); + if ( !TreeView_SelectDropTarget(GetHwnd(), 0) ) + wxLogLastError(wxS("TreeView_SelectDropTarget(0)")); } #endif // wxUSE_DRAGIMAGE @@ -3235,7 +3241,8 @@ wxTreeCtrl::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) // if we don't do it, the tree seems to think that 2 items // are selected simultaneously which is quite weird - TreeView_SelectDropTarget(GetHwnd(), 0); + if ( !TreeView_SelectDropTarget(GetHwnd(), 0) ) + wxLogLastError(wxS("TreeView_SelectDropTarget(0)")); } } }