Click here to learn
about this Sponsor:
Home  |  News  |  Articles  |  Forum

  Home arrow Windows For Devices Articles arrow Glorious Gadgets [MSDN]

Glorious Gadgets [MSDN]
By jill

Rate This Article: Add This Article To:

Don’t let the title fool you. Microsoft's John Kennedy keeps it real. Like, which tools can be used to develop Pocket PC applications and which ones can't? Answer: “To develop Pocket PC applications using .NET Compact Framework, you'll need to own a complete version of Visual Studio .NET, such as the professional, enterprise, or academic releases...Buying the standalone language versions of Visual C# or...

Visual Basic .NET and the SDE plug-in will not work."



Glorious Gadgets


Summary: John Kennedy provides an overview of the exciting new devices hitting the market, including Smartphones, Tablet PCs, and Smart Displays. (4 printed pages)

Introduction

Boy oh boy, what a gadget-filled last few months I've had. As well as playing with the Smartphone, I've been experimenting with Tablet PCs and Smart Displays. There is no doubt that the Tablet PC is an amazing new class of computer — a touch screen that you can rest your hand on while you write is something that might possibly blow the mind of the typical Pocket PC user. With its ultra-fast pressure-sensitive stylus and the most advanced handwriting recognition/management system on the planet, you shouldn't try one unless you can afford to buy one. Really.

I also hope that with the inevitable interest in pen-based computing that the Tablet PC will create, that we'll start to see some more development of the entire non-keyboard computing environment. Perhaps even an implementation of my own personal dream, development tools that can convert our sketches of killer applications into real world source code. More interest in pen-based systems will only benefit the Pocket PC, so think of the Tablet PC as an ally rather than a competitor.

The Smart Displays are cool too. They used to be known by their codename "Mira," and they are LCD-screen panels that run a version of Microsoft Windows CE (ah, that got your attention!). It's certainly fun being able to pick up a computer monitor and carry it downstairs into the living room to watch an episode of Seinfeld, while continuing to work on some eMbedded Visual Tools programming. Assuming that your home is wired, by which I mean wireless with 802.11b WiFi radiation, you can literally take your computer with you wherever you go.

The Future of Smart Device Extensions

If you are a regular reader, you'll know that we've taken a look—and there will be a lot more to come — at Smart Device Extensions (SDE) that allow dedicated programmers like ourselves to create .NET applications for the Pocket PC.

Here's a newsflash — soon you won't be hearing the term SDE plug-in any more. Yes, the SDE plug-in is dead. Now, stop your screaming! This is only one of those things that marketing people get excited about; the tools encompassed by the SDE are very much an important part of the .NET initiative. In fact, they have recently been given a serious performance and reliability boost in time for a second beta.

As you probably know, the SDE is currently available in beta format to some registered users. If you are eligible for this program, you're probably already aware of it. This is one of those closed beta things that I'm afraid I can't help you with no matter how much Cadbury chocolate you send me in unmarked packages care of Microsoft, Redmond, WA 98052. So don't even try.

The good news is that in the not-to-distant future, the SDE plug-in (as it used to be called) won't be in beta anymore and will finally be released. However, this time around it won't be released as a stand-alone toolkit. Instead, the SDE components are going to be an integral part of the next Visual Studio .NET package, named Visual Studio .NET 2003.

In other words, to develop applications for the Pocket PC using the .NET Compact Framework, you'll need to be the owner of a complete version of Visual Studio .NET, such as the Professional, Enterprise, or Academic releases. The method that I've mentioned before, that is, buying the standalone language versions of Visual C# or Visual Basic .NET and the SDE plug-in, will not work.

From this point, the concept of the SDE as an optional extra will cease to be, and we'll simply be using Visual Studio, and building a project designed for the Pocket PC platform. I hope that makes sense to you. The bottom line is that if you don't already have Visual Studio .NET, it's time to start saving those pennies. And here's a tip — sign up for MSDN and you get access before everyone else.
Language Refresher Course

With all these new gadgets appearing, not to mention new software tools, it's worth taking the time to perform a refresher course on what tools and languages you should be using for the various platforms.

To develop applications for the Pocket PC, you have a choice. You can use the eMbedded Visual Tools to write software using Visual C++ or Visual Basic. Note that the Visual Basic implementation is closer to script than true Visual Basic, and check out Larry Roof's share of the Two For the Road column for more.

The other choice is to use the .NET Compact Framework. This next generation Pocket PC tool is built-into Visual Studio .NET 2003, as detailed above. It provides support for writing managed code using the .NET Compact Frameworks, and supports full implementations of Visual C# and Visual Basic .NET.

If the peek we had at the Smartphone whetted your appetite for developing, you'll need to stick to the eMbedded Visual Toolkit, with Visual C++ and Visual Basic. At this time, there is no .NET toolkit for the Smartphone and no version of the .NET Framework for the Smartphone.

Speaking of the Smartphone, it looks like its release is getting closer. Recently Orange, my favorite UK mobile phone company, announced Smartphone devices for use on its network. Here's hoping it appears in other countries soon!

Finally, if the big brother of the Pocket PC, a.k.a. the Tablet PC, is something you would like to develop for, there are tools for that too. It's not really my remit to even discuss it, but what the heck. There is a special Tablet PC SDK available for use with Visual Studio. It even works with graphics tablets if you haven't got an actual Tablet PC yet.

Back to Code

I got a bit distracted from looking at some SDE programming by the Smartphone, and I'd promised to describe how to work around some of the limitations of using the .NET Compact Framework. I guess I shouldn't use the word limitations, as the .NET Compact Framework provides more new features than, well, something that provides a LOT of new features, but it's still sometimes necessary to do things the old fashioned way. Several Pocket PC specific features are not yet directly supported, and that can be a bummer. The good news is that it's not a reason to stop you from working with C#, as you'll soon see.

If you remember, the key to using the .NET Compact Framework on the Pocket PC is the use of the Visual C#, or Visual Basic .NET, languages. These languages produce managed code and provide access to the .NET Compact Framework classes that look after everything from file manipulation to XML Web services. However, they don't provide support for everything. For example, making your Pocket PC go beep.

Using the eMbedded Visual Tool C++ language, you would make the beep noise by calling the API sndPlaySound. This API takes a WAV filename and an integer for various options, and triggers the sound playback. Unfortunately, there is no .NET Compact Framework class provided for that, and so instead, it's necessary to use a technical called platform invoke.

To quote the documentation, "Platform invoke is a service that enables managed code to call unmanaged functions implemented in dynamic link libraries, such as those in the Win32 API." This means you can use the built-in DLL libraries to call the API functions you know and love, or even use your own DLL to make use of any functions you've previously written and don't want to port (yet) to C#.

It might be tempting to think about using the API functions to simply recreate your application in C#, but really, it's a better idea to make use of the .NET Compact Framework whenever possible. Jumping back into unmanaged code every few instructions isn't going to do wonders for performance, nor is it going to help with the key advantages of .NET coding — reliability, security and, what's that other one? Oh yeah, coolness.

Using Platform Invoke

It's surprisingly easy to use older API functions. Here's an example class that wraps the sndPlaySound API.
using System.Runtime.InteropServices;

public class Win32{
[DllImport("coredll.dll", CharSet=CharSet.Auto)]
public static extern bool sndPlaySound(String lpszSoundname, uint fuSound);
}


You can see that it declares the new class member using the same parameters as the original API, and references the DLL coredll.dll that is in the ROM of every Pocket PC device.

To make use of this function in your C# code, you only need to use a line like this:

Win32.sndPlaySound("Alarm1",0);

And it plays the correct WAV file.

What's Next?

OK, now I don't know about you — the private detective agency hasn't given me the next report — but I'm interested in writing applications using C# on the Pocket PC, and I'm interested in writing applications in Visual C++ for the Smartphone.

What I'd like to know is what topics you would be interested in learning about? I've got a list of C# projects I intend to work through, so if you have suggestions, please either mail me directly at johnkenn@microsoft.com or add a note to the discussion thread options at the top of the column.

Links


About the authors:

John Kennedy is a Technical Writer/Programmer in the Visual C++ group by day and leads a secret life as a Pocket PC developer by night.

Larry Roof heads up larryroof.com, a firm that specializes in consulting on mobile projects and training on eMbedded Visual Basic, Smart Device Extensions, and SQL Server CE.




Copyright (c) 2002 Microsoft Corporation. All rights reserved. Reproduced by WindowsForDevices.com under license.




Discuss Glorious Gadgets [MSDN]
 
>>> Be the FIRST to comment on this article!
 
 
 
>>> More Windows For Devices Articles Articles          >>> More By jill
 



Windows XP for Embedded Applications
This white paper describes the benefits of using Windows XP when developing embedded applications.

A Manager's Guide to Selecting a Mobile Device Operating System
This white paper offers a comparative review of Microsoft Windows CE and Windows Mobile.

Visual Basic 6.0 to .NET Migration
This paper focuses on the methodology and techniques which Infosys (Microsoft Technology Center) has developed for migrating VB 6.0 Applications to .NET. Our approach ensures a smooth, cost effective, and efficient migration.

Mobile Device Security: Securing the Handheld, Securing the Enterprise
This whitepaper identifies security threats to corporate data on mobile devices and details how mobile devices can become a "backdoor" to the enterprise.

Mobile Device Security: The Eight Areas of Risk
It's common knowledge that adding mobile devices to your network increases security risks. There are multiple facets to mobile security, all of which should be paid close attention to. This E-Guide presents a more in depth look into the eight key areas of securing wireless devices.

Quality Assurance and .NET
This paper discusses best practices for functional, regression and load testing of .NET applications.

SCADA Security in Integrated Networks
As businesses leverage their SCADA systems by integrating them into the business networks, they must also assure the security of the SCADA system.

The Advantages of Small Form Factor HMI
HMIs have mutated and changed with new requirements, and they have become more flexible and capable. And while they've been doing that, they've become smaller and more useful.

9 Critical Requirements for Web Application Security
Learn why your Web applications expose dangerous security breaches and what’s required to effectively protect your Web applications and the sensitive information behind them.

Got a HOT tip?   please tell us!
Free weekly newsletter
Enter your email...
Click here for a profile of each sponsor:
PLATINUM SPONSORS
(Become a sponsor)

ADVERTISEMENT
(Advertise here)

Updated! The latest Windows-powered...

mobile phones!

other cool
gadgets

HOT TOPICS
Microsoft targets PNDs with new embedded OS
Microsoft tips .NET MF 3.0 highlights
Microsoft previews Windows Embedded Standard
Microsoft offers free Windows CE 6.0 textbook
Microsoft renames embedded operating systems
Microsoft unveils Windows Mobile 6.1
New Atom models target low-cost PCs
REFERENCE GUIDES
Windows Device Showcase
Intro to Windows Embedded
Intro to Shared Source
Real-time Windows Embedded
Windows Embedded books
Join our Windows Embedded discussion forums:
Windows XP Embedded
Windows CE
Windows Mobile


Windows Embedded developer newsgroups
Windows CE
XP Embedded
PocketPC
Smartphone

Microsoft's Windows Embedded resources
Embedded dev center
Mobile dev center
Windows CE tutorials
XP Embedded tutorials
Windows Embedded seminars
Windows Embedded application categories
3rd-party partners


BREAKING NEWS

• Pico-ITX PC takes to the road and the skies
• Thin client offers legacy ports
• Boards add watchdog functionality to PC/104-Plus systems
• 11.6-inch netbook has AMD processor
• Microsoft planning riposte to Google's "Chrome OS"?
• Embedded student competition winner is buggy (on purpose)
• Asus preps convertible netbooks
• Media-savvy reference design sports touchscreen, DVB-H
• Sony joins the netbook fray
• 2010 Census kicks off with Windows Mobile
• Sprint offers 99-cent netbook
• SODIMM module has industrial focus
• Microsoft picks finalists in Embedded Development competition
• Cortex-A8 SBCs target signage and kiosks
• Student competition offers a different kind of fireworks


MOST POPULAR (last 90 days)
• "Netbook" uses Intel's Atom N270
• Windows CE takes on Linux in low-end netbooks
• HTC ups Touch resolution
• Microsoft unleashes new embedded OS
• Windows Mobile phone gets 800 x 480 display
• HTC spins WiMAX phone?
• Smart camera sports Atom
• Dual-core AMD netbook gets rave review
• Windows Mobile 7 "delayed"
• GPS phone uses new Marvell "Tavor" chip
MOST POPULAR (Classics from the vault)
Windows XP Embedded USB boot
Troubleshooting Windows XPe's blue screen "Stop 0x0000007B" error
Asus reveals $190 mini notebook
Windows Mobile 6 SDKs available for download
Windows Mobile VPN client plays with Cisco
HTC adds GPS to Windows Mobile Touch line
Microsoft unveils Windows Mobile 6.1
Guide to HTC's Windows Mobile smartphone platforms
• HTC releases Touch Diamond ROM upgrade
Customizing Windows XP Embedded thin clients

Also visit our sister sites:

Sign up for WindowsForDevices.com's...


Or, follow us on Twitter...