]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listbox.cpp
Cleanup
[wxWidgets.git] / src / msw / listbox.cpp
index e8bfb9b75c9b80fb7f74a476e8fc4e0d86863f17..1f8a77955d1dc60cc3a1bd615e77391d53a4aafe 100644 (file)
@@ -354,7 +354,7 @@ int wxListBox::FindString(const wxString& s, bool bCase) const
     if (bCase)
        return wxItemContainerImmutable::FindString( s, bCase );
 
-    int pos = ListBox_FindStringExact(GetHwnd(), (WPARAM)-1, s);
+    int pos = ListBox_FindStringExact(GetHwnd(), -1, s);
     if (pos == LB_ERR)
         return wxNOT_FOUND;
     else
@@ -776,16 +776,19 @@ bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item)
     HDC hdc = CreateIC(wxT("DISPLAY"), NULL, NULL, 0);
 #endif
 
-    wxDC dc;
-    dc.SetHDC((WXHDC)hdc);
-    dc.SetFont(GetFont());
-
-    pStruct->itemHeight = dc.GetCharHeight() + 2*OWNER_DRAWN_LISTBOX_EXTRA_SPACE;
-    pStruct->itemWidth  = dc.GetCharWidth();
+    {
+        wxDCTemp dc((WXHDC)hdc);
+        dc.SetFont(GetFont());
 
-    dc.SetHDC(0);
+        pStruct->itemHeight = dc.GetCharHeight() + 2*OWNER_DRAWN_LISTBOX_EXTRA_SPACE;
+        pStruct->itemWidth  = dc.GetCharWidth();
+    }
 
+#ifdef __WXWINCE__
+    ReleaseDC(NULL, hdc);
+#else
     DeleteDC(hdc);
+#endif
 
     return true;
 }