NMD UI (Windows CE 5.0)

Windows CE 5.0
Send Feedback

The Sample application is made up of the following files:

This class is the entry point to the application. It initializes the libraries, verifies that the device resolution is valid and starts the application.

Display-related Pages

These pages all use ODLIB to draw user-interface elements to the screen.
This is the main menu page. Also handles data loading and event processing for server changes.
This is the base class for the data view pages. This does all the real work of displaying a view page. It creates the buttons, listbox etc.
These customize the view page with the data type specific information (icon, title, content type)
This acts as the central location that combines display information with the data source for the list view.
This page is used to view the current playlist. Allows manipulation of the items in the playlist and entry to the options for the playlist.
This is the playlist options page. Options available depend on the type of playlist being shown (there are 3 active playlists, one each for music, video and pictures).
This page shows the details for an item when it is selected. The details shown depend on the type of the item. This provides a good example how to get specific information about an item from the MQE.
This page is displayed when a playlist is playing.
This page provides playlist load and save functionality, does file name entry for save and allows picking a file name (for load). Although disabled in the NMD UI, this code will work and can be enabled. See the sample readme for information about why this feature is disabled.
This is a utility page used by the settings pages when a data field needs to be changed. This interacts with the SIP to allow a remote controlled SIP input.

Playlist-related Files:

This is the central point for the playlists. Holds the 3 playlists, also coordinates resource usage between playlists. For example, if a picture playlist is playing, do not allow a video playlist to play as there is only one display surface.
This provides the actual playlist functionality.
This is the heart of the playlist. This file contains most of the code that actually plays content. It includes calls to DirectShow to play back music and video and a wrapper for picture streaming (Pictures do not go through DirectShow).
This starts a thread that sends a message to the playlist / now playing page. It is used to update the music playback progress bar and cause picture changes during slideshows.

MQE-related Files

This is a scheduler that runs a thread to do background data caching.
This is a collection of all the MQEDataSource objects used to feed the view listboxes.
This is a wrapper for a MQE query, and contains the query parameters and batch size information. It also maintains a list of CMyBatch objects, each of which contains a batch (page) of data.
This is a wrapper for a MQE batch that allows you to keep the relevant thumbnails attached the batches.
This is the event sink for all the MQE Events.

Utility Files

Sliding list boxes (the list boxes used for views) require a data source. This is a simple sample list based data source.
This is used for performance tracking after the end of DirectShow media playback.

Settings-related Files

The following files contain source code for NMD settings:

This class contains the adapter listener thread, which listens for changes in adapter state.
This class contains the IP address info for an adapter. This class is used to communicate information about the IP address of adapter to the UI class.
This class interacts with the Media Query Engine to get an updated list of media servers. It also dismisses the Waiting for Authorization dialog box when the WMC sends a device authorized event.
This class contains name servers information for the network adapter.
This class converts an IP address to a string and performs conversion operations.
This class is main information source for network settings data. The network data source manages listener threads and maintains network data for available networks.
This class contains the information displayed in current network settings page.
This class interacts with the registry to obtain adapter specific data. When the user makes changes to names or IP or name server settings, this class saves the data and restarts the adapter to make the changes effective.
This file contains settings for UI effects, video display and play-list options. It also makes the settings persist.
The WiFi network information class interacts with WZC (Wireless Zero Configuration) to obtains latest list of wireless networks.
This file implements the functionality to connect to the wireless network.
This is shim for wzcapi.dll
This is a thread that listens for messages for WZC. The WZC messages include information about current connection status with a wireless network.
The wlan configuration contains encryption, authentication and mode for a wireless network.

User Interface Pages for Settings

The following files contain source code for the user interface pages for the NMD settings:

This file contains the user interface for the Settings->About page.
These pages show the current network settings for the wired and wireless interfaces. The change IP address and name servers page allows these values to be changed and saves the new values.
This page displays current name of the NMD device. This is the name that is displayed in the Windows Media Connect (WMC) device list. The user can change the device name in this screen. The name change propagates to WMC and the name is refreshed in the WMC list.
This contains the main menu for NMD settings.
This page displays the UDN and current status of the selected media server. It allows the user to activate a server, or make a server the current content provider.
This page displays the list of media servers.
This page presents the network menu options. Based on the present adapters, the user interface presents buttons for wired and/or wireless network settings options.
This page has menus for the wired and wireless network. For wired network, the options are Current Network Settings and Change Network Settings. For the wireless network, the options are Change Network Settings, Current Network Settings and Wireless Networks.
This file loads the resource strings from the resource file.
The page contains the options for UI effects.
This page contains the video display options.
This page gives the user the option to connect to a particular wireless network. The page prompts the user to enter the network key.
The page presents a list of the wireless networks visible to the NMD device.

Data Flow in NMD_UI

Start-up Data Flow

There is an initial data load pass to seed all the data queries and then the data pre-cache is filled by way of a background update thread.

  • In CMainMenuPage::Show, in the file MainMenu.cpp, the server is checked against the last active server. If these do not match a WM_APP_WMC_NewServer message is sent to the top window.
  • This message is processed in CMainMenuPage::ALProcessMessage
  • A dialog is displayed to the user "Loading initial data set" and g_DataStoreManager.InitDataSources is called. This function resets the data caches and then creates a new set of base queries. Each query then loads its first page of data.
  • Once the initial data set is loaded a WM_APP_DataStore_DataReady message is sent. This is once again processed in the main menu message procedure. It then sends a WM_APP_WMC_ActiveServer message.
  • WM_APP_WMC_ActiveServer processing enables the menu buttons and clears the busy state. This clears the loading dialog.

Data Cache Flow

The sample application reads data from the Windows Media Connect server in a paged manner. When a row of data is requested from the CMQEDataSource class which is contained in the MQEDataSource.cpp file, the required page is centered in the data cache by the CMQEDataSource::FindPage method. This sets m_pCurrentPage to the required page.

The last thing done by FindPage is to schedule a background update of the data cache for the data source by calling g_BatchScheduler.ScheduleUpdate. This puts an entry into the background batch scheduler. The scheduler then walks through the list of scheduled objects and makes a call to the objects ScheduledUpdate method.

In the case of the data source that is CMQEDataSource::ScheduledUpdate. This checks to make sure that there is at least two pages previous and after the current page loaded into the data cache.

To insure that the working set does not grow overly large it then does a trim pass to make sure that the total set of cached pages for this data source is not more than 9.

Exiting the Application

To exit the application during testing and development, press Ctrl+Shift+Esc or Ctrl+Esc.


You can design your hardware to respond to front-panel and remote control key presses by sending the following key-codes to the sample application through the keyboard driver.

HomeVK_HomeReturn to main menu
EscapeVK_EscapeExit the current page
BackspaceVK_BackReturn up a level when you have drilled into a folder
EnterVK_ReturnSelect item (referred to as "Select" in on screen messages)
F2VK_F2Add To playlist
F3VK_F3Play playlist
F4VK_F4View playlist
F5VK_F5Add all to playlist
F10VK_F10Fast Forward (This may or may not work depending on support for content type)
F11VK_F11Rewind (This may or may not work depending on support for content type)
F12VK_F12Play (will immediately play currently selected item)
DeleteVK_DELETE Delete an item when viewing playlist
Up arrowVK_UP 
Down arrowVK_DOWN 
Left arrowVK_LEFT 
Right arrowVK_RIGHT 

Remote Control Key Code Remapping

The NMD UI has a function CNMDApp::PreProcKeysImp which can be used to remap remote controls keys into the keys the UI expects. This allows you to quickly get started when you do not directly control the key-codes on the remote control you are using.

This is used in the sample application to remap some of the FKeys into media keys:

void CNMDApp::PreProcKeysImp(MSG &rMessage)
   // virtual method
   switch (rMessage.message)
      case WM_KEYUP:
      case WM_KEYDOWN:
         switch (rMessage.wParam)
            case VK_F10:
               //TRACE(TEXT("Remaping VK_F10 to VK_PRIOR"));
               rMessage.wParam = VK_PRIOR;
            case VK_F11:
               //TRACE(TEXT("Remaping VK_F11 to VK_NEXT"));
               rMessage.wParam = VK_NEXT;
            case VK_F12:
               //TRACE(TEXT("Remaping VK_F12 to VK_PLAY"));
               rMessage.wParam = VK_PLAY;

See Also

Networked Media Device Sample Application

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.