Closing a wxDialog ('x' system button)

Hi all,

  I would like to translate this python sample into C++ code:

#python version
#this code is working for me:
from wxPython.wx import *

class DymmyClass(wxApp):
     def OnInit(self):
         dlg = wxDialog(None, -1, "coucou")
         dlg.ShowModal()
         dlg.Destroy()
         return 1

if __name__ == "__main__":
     app = DymmyClass()
     app.MainLoop()

//C++ version
//This one is not:
#include <wx/wx.h>

class DummyClass: public wxApp {
public:
     bool OnInit();
};

IMPLEMENT_APP(DummyClass)

bool DummyClass::OnInit()
{
     wxDialog dlg(0, -1, "coucou");
     int ret = dlg.ShowModal();

     dlg.Destroy(); //doesn't do anythingh
     dlg.EndModal( ret ); //same here
     dlg.Close(); //idem

     return true;
}

I have been reading:

- http://www.wxwindows.org/technote/dlgbased.htm
- http://lists.wxwindows.org/archive/wx-users/msg33947.html

But none of the proposed method seems to work.

Please help,
mathieu
Ps: I am using wxGTK 2.4.0, 2.4.1 and wxPython 2.4.0.7