FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Dobbs M-Dev
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
December 01, 2003

Handling Multiple Win32 Operating Environments

(Page 8 of 9)
Handling Multiple Win32 Operating Environments

Listing 6 WinSTL-s listbox_front_inserter function object

namespace winstl
{
  struct listbox_front_inserter
  {
  public:
    explicit listbox_front_inserter(HWND hwndListbox)
      : m_hwndListbox(hwndListbox)
      , m_bUnicode(::IsWindowUnicode(hwndListbox))
    {}

    void operator ()(char const *s)
    {
      insert(s);
    }
    void operator ()(wchar_t const *s)
    {
      insert(s);
    }

  // Implementation
  private:
    void insert(char const *s)
    {
      if(m_bUnicode)
      {
        listbox_insertstring_w(m_hwndListbox, a2w(s), 0);
      }
      else
      {
        listbox_insertstring_a(m_hwndListbox, s, 0);
      }
    }
    void insert(wchar_t const *s)
    {
      if(m_bUnicode)
      {
        listbox_insertstring_w(m_hwndListbox, s, 0);
      }
      else
      {
        listbox_insertstring_a(m_hwndListbox, w2a(s), 0);
      }
    }

  private:
    HWND  m_hwndListbox;
    bool  m_bUnicode;
  };
} // namespace winstl
Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK