+ // we need to register this class
+ WNDCLASS wndclass;
+ wxZeroMemory(wndclass);
+
+ wndclass.lpfnWndProc = (WNDPROC)wxWndProc;
+ wndclass.hInstance = wxhInstance;
+ wndclass.hCursor = ::LoadCursor(NULL, IDC_ARROW);
+ wndclass.hbrBackground = (HBRUSH)wxUIntToPtr(bgBrushCol + 1);
+ wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | extraStyles;
+
+
+ ClassRegInfo regClass;
+ regClass.basename = name;
+
+ // constuct a unique suffix to allow registering the class with the same
+ // base name in a main application using wxWidgets and a DLL using
+ // wxWidgets loaded into its address space: as gs_regClassesInfo variable
+ // is different in them, we're going to obtain a unique prefix by using its
+ // address here
+ regClass.regname = regClass.basename +
+ wxString::Format(wxT("@%p"), &gs_regClassesInfo);
+ wndclass.lpszClassName = regClass.regname.wx_str();
+ if ( !::RegisterClass(&wndclass) )
+ {
+ wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"),
+ regClass.regname));
+ return NULL;