#if defined(__WXWINCE__)
   #include <ole2.h>
   #include <shellapi.h>
-  #include <aygshell.h>
+  #if _WIN32_WCE < 400
+    #include <aygshell.h>
+  #endif
 #endif
 
 // include <commctrl.h> "properly"
                 event.m_col = nmHDR->iItem;
                 break;
 
-#ifdef __WXWINCE__
+#if defined(__WXWINCE__) && _WIN32_WCE < 400
             case GN_CONTEXTMENU:
 #endif //__WXWINCE__
             case NM_RCLICK:
 
                     // where did the click occur?
                     POINT ptClick;
-#ifdef __WXWINCE__
+#if defined(__WXWINCE__) && _WIN32_WCE < 400
                   if(nmhdr->code == GN_CONTEXTMENU) {
                       ptClick = ((NMRGINFO*)nmhdr)->ptAction;
                   } else 
                 event.m_item.m_data = GetItemData(iItem);
                 break;
 
-#ifdef __WXWINCE__
+#if defined(__WXWINCE__) && _WIN32_WCE < 400
             case GN_CONTEXTMENU:
 #endif //__WXWINCE__
             case NM_RCLICK:
                 LV_HITTESTINFO lvhti;
                 wxZeroMemory(lvhti);
 
-#ifdef __WXWINCE__
+#if defined(__WXWINCE__) && _WIN32_WCE < 400
               if(nmhdr->code == GN_CONTEXTMENU) {
                   lvhti.pt = ((NMRGINFO*)nmhdr)->ptAction;
               } else 
 
 #include <ole2.h>
 #include <shellapi.h>
 #include <commctrl.h>
+#if _WIN32_WCE < 400
 #include <aygshell.h>
-
-#ifndef TBSTYLE_NO_DROPDOWN_ARROW
-#define TBSTYLE_NO_DROPDOWN_ARROW 0x0080
 #endif
 
+#include "wx/msw/wince/missing.h"
+
 #endif
 
 // other standard headers
     // since you have to use resources.
     // We'll have to find another way to add a menu
     // by changing/adding menu items to an existing menu.
-#ifdef __WXWINCE__
+#if defined(__WXWINCE__) && _WIN32_WCE < 400
     if ( m_hMenu != 0 )
         return m_hMenu;
 
         }
     }
 
+#if _WIN32_WCE >= 400
+    if (GetToolBar())
+    {
+        HWND hCommandBar = (HWND) GetToolBar()->GetHWND();
+        if (!CommandBar_InsertMenubarEx(hCommandBar, NULL, (LPTSTR) m_hMenu, 0))
+        {
+            wxLogLastError(wxT("CommandBar_InsertMenubarEx"));
+        }
+    }
+#endif
+
     return m_hMenu;
 #endif
 }
 
 #if defined(__WXWINCE__)
   #include <ole2.h>
   #include <shellapi.h>
-  #include <aygshell.h>
+  #if _WIN32_WCE < 400
+    #include <aygshell.h>
+  #endif
+#include "wx/msw/wince/missing.h"
 #endif
 
 #include "wx/msw/winundef.h"
                      rect.x, rect.y, rect.width, rect.height,
                      flags);
 
-#ifdef __WXWINCE__
+#if __WXWINCE__ && _WIN32_WCE < 400
         ::SHFullScreen(GetHwnd(), SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);
 #endif
 
     }
     else // stop showing full screen
     {
-#ifdef __WXWINCE__
+#if __WXWINCE__ && _WIN32_WCE < 400
         ::SHFullScreen(GetHwnd(), SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON);
 #endif
         Maximize(m_fsIsMaximized);
 
 #include <ole2.h>
 #include <shellapi.h>
 #include <commctrl.h>
-#include <aygshell.h>
+#if _WIN32_WCE < 400
+  #include <aygshell.h>
+#endif
+#include "wx/msw/wince/missing.h"
 
 #include "wx/msw/winundef.h"
 
     if (m_menuBar)
         m_menuBar->SetToolBar(this);
 
+#if _WIN32_WCE >= 400
+    HWND hWnd = CommandBar_Create(wxGetInstance(), (HWND) GetParent()->GetHWND(), GetId());
+    SetHWND((WXHWND) hWnd);
+#else
     // Create the menubar.
     SHMENUBARINFO mbi;
     
     }
     
     SetHWND((WXHWND) mbi.hwndMB);
-/*
-    if (!::SendMessage((HWND) GetHWND(), TB_DELETEBUTTON, 0, (LPARAM) 0))
-    {
-        wxLogLastError(wxT("TB_DELETEBUTTON"));
-    }
-*/    
+#endif
+
     // install wxWindows window proc for this window
     SubclassWin(m_hWnd);