Virtual Developer Workshop: Containerized Development with Docker
As initially conceived, palmtop devices were nothing more than special purpose standalone computers—fun and intriguing, but of limited practical use, precisely because they were inherently and imperviously encapsulated. Windows CE's RAPI technology dramatically expands the palmtop computing metaphor, by integrating seamless connectivity with the larger Windows world. In effect, this allows CE devices to "borrow" the storage, processing power, and networking infrastructure of the Windows Desktop. These capabilities also transform the CE programming model. Being a good CE application designer is about more than knowing how to write native code for the CE side. You need a larger worldview. The "big picture" is one in which the desktop and the CE device collaborate to produce a result neither could accomplish independently. This is the true culmination and ultimate promise of CE.
In the preceding examples, you've seen how to query a CE device from the desktop to retrieve status information, access the Registry, and manipulate files and databases. These are powerful tools indeed, because they redefine the very nature of palmtop and handheld computing, giving you flexibility that doesn't exist in the standalone world. In this example, you equip yourself with the most powerful of tools for blending the strengths of the desktop with the mobility of the handheld device: remote procedure calls from the desktop to the CE device.
The ability to invoke functions dynamically on the CE side enables a spectrum of possibility in terms of embedded applications and end-user—oriented applications. You'll use upcoming examples both to explore how to use RAPI's RPC mechanism, and the ways in which it broadens the scope of handheld and palmtop computing. In this sense, the subject matter of these lessons is as much about programming strategy as about programming technique. Thinking beyond the "handiness" of having a contacts database or lightweight word processor in your pocket, you must imagine more dynamic and flexible kinds of scenarios. Here are some possibilities for what you might do with remotely invoked functions:
- Awaken device sensors and relay data directly to the network rather than storing them locally.
- Dynamically provide tailored information, including sound and images.
- Unload CE device storage, saving contents on the desktop side to free space for dynamically invoked tasks. Replace storage contents when processing is complete.
In this lesson, the example program, DesktopRAPIInvoker, employs a desktop MFC application to transfer a text or HTML file to the handheld, and then allows you to invoke an application on the CE side that displays the transferred file in an HTML viewer control.
The DesktopRAPIInvoker Example
In the DesktopRAPIInvoker example, you'll explore two useful technologies: First, you'll see how to call a CE-side function from the desktop using CeRapiInvoke(), and how to create a corresponding CE side DLL. This procedure is what allows you to remotely invoke functions. Second, you'll see how to use the Windows CE HTML Viewer control to display HTML or plain text.
There are three critical elements in this process. First, you create a desktop application to initialize RAPI, transfer the files you want to display in the HTML Viewer control, and invoke the remote process. On the CE side, you need a DLL that contains a specific type of function you can invoke from the desktop. Also on the CE side, you need the HTML viewer application that displays the transferred file.
In the interest of brevity, I include only the critical files for each of the components. I'll omit files that would be generated as "boiler plate" by development environment tools.
Source Files for DeskTopRAPIInvoker Example
|Source File Name||Header File Name||Implements||Listing Included In Text|
|MainFrm.cpp||MainFrm.h||Application's main frame window||Yes|
|StdAfx.cpp||StdAfx.h||Standard application frameworks support||No|
Next time, you'll look into how the DesktopRAPIInvoker application transfers files between the desktop and the CE side device.
About the Author
Nancy Nicolaisen is a software engineer who has designed and implemented highly modular Windows CE products that include features such as full remote diagnostics, CE-side data compression, dynamically constructed user interface, automatic screen size detection, and entry time data validation.
In addition to writing articles, she has written several books, including Making Win 32 Applications Mobile.
# # #