Remote Presentations With RAPI and the HTML Viewer Control

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
DesktopRapiInvoker.cpp DesktopRapiInvoker.h Application object No
DesktopRapiInvokerDoc.cpp DesktopRapiInvokerDoc.h Document Object No
DesktopRapiInvokerView.cpp DesktopRapiInvokerView.h View Object No
MainFrm.cpp MainFrm.h Application's main frame window Yes
StdAfx.cpp StdAfx.h Standard application frameworks support No
DesktopRapiInvoker.rc Resource.h Resources No

Looking Ahead

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.

# # #



About the Author

Nancy Nicolaisen

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 for Developer.com and CodeGuru, she has written several books, including Making Win 32 Applications Mobile.

Downloads

Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Companies undertaking an IT project need to find the right balance between cost and functionality. It's important to start by determining whether to build a solution from scratch, buy an out-of-the-box solution, or a combination of both. In reality, most projects will require some system tailoring to meet business requirements. Decision-makers must understand how much software development is enough and craft a detailed implementation plan to ensure the project's success. This white paper examines the different …

  • Finance leaders have been talking about expanding the value-added role of their teams for a long time. The debate is no longer whether the finance and accounting function needs to become a more strategic partner to the rest of the business but rather how to get there. Technology innovation has caught up to this ambition, and what was once aspiration can be a reality – and the choice is now yours. Read this research report to learn how to make the most of information tools to enable innovation and growth.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date