title: Drawing *.ico file on wxWidgets
body: <p>I tried to write a program to draw all possible sizes of an image from *.ico file.</p>
  
  <p>My code for this:</p>
  
  <pre><code>&lt;!-- language: lang-cpp --&gt;
  
  #include &lt;wx/wx.h&gt;
  #include &lt;wx/colour.h&gt;
  #include &lt;wx/filesys.h&gt;
  
  wxString path("c:\\...\\*.ico");
  
  class MyApp: public wxApp
  {
      virtual bool OnInit();
  };
  
  class MyFrame: public wxFrame
  {
  public:
      MyFrame(const wxString&amp; title, const wxPoint&amp; pos, const wxSize&amp; size);
      void paint(wxPaintEvent&amp; event);
  private:
      DECLARE_EVENT_TABLE()
  };
  
  BEGIN_EVENT_TABLE(MyFrame, wxFrame)
      EVT_PAINT(MyFrame::paint)
  END_EVENT_TABLE()
  
  IMPLEMENT_APP(MyApp)
  
  bool MyApp::OnInit()
  {
      MyFrame *frame = new MyFrame("ICO Test", wxPoint(50, 50), wxSize(600,300) );
      frame-&gt;Show(true);
      SetTopWindow(frame);
      return true;
  }
  
  MyFrame::MyFrame(const wxString&amp; title, const wxPoint&amp; pos, const wxSize&amp; size)
  : wxFrame( NULL, -1, title, pos, size )
  {
      wxInitAllImageHandlers();
  }
  
  
  void MyFrame::paint(wxPaintEvent&amp; event)
  {
      wxPaintDC dc(this);
  
      int count = wxImage::GetImageCount(path, wxBITMAP_TYPE_ICO);
      dc.DrawText(wxString::Format(wxT("count is: %ld"), count), 40, 20);
      int x_pos = 20;
      for (int i = 0; i &lt; count; ++i)
      {
          wxImage image;
          if (image.LoadFile(path, wxBITMAP_TYPE_ICO, i ))
          {
              wxIcon icon;
              icon.CopyFromBitmap(wxBitmap(image));
              dc.DrawIcon(icon, wxPoint(x_pos, 40));
              int h = icon.GetHeight();
              dc.DrawText(wxString::Format(wxT("%ld"), h), x_pos + 3, 45 + h);
              x_pos += (icon.GetWidth() + 4);
          }
      }
  }
  </code></pre>
  
  <p><a href="http://www.veryicon.com/icon/ico/System/Oxygen/apps%20utilities%20terminal.ico" rel="nofollow">Icon</a> for testing. (which I found by searching on Google)</p>
  
  <p>All works fine except 256x256 size (it doesn't draw them).</p>
  
  <p>The application throws this error: <code>DIB Header: Image width &gt; 32767 pixels for file.</code>.</p>
  
  <p>My system:</p>
  
  <ul>
  <li>Windows 7 x64</li>
  <li>MinGW 4.8.2</li>
  <li>wxWidgets 3.0</li>
  </ul>