J2i.Net

Nothing at all and Everything in general.

Windows Marketplace for Mobile now Live!

The Windows Marketplace for Mobile is now Live. If you fire up your 6.5 Emulator and click on the Marketplace icon you'll be able to log in look around.  Right now only a few applications are available.  Edward from MSMobiles.com has uploaded a video to youtube (http://www.youtube.com/watch?v=i6Py1ZYyy1s) and written a review on it (http://msmobiles.com/news.php/8641.html ). Windows Mobile 6.5 devices will start to roll out into the hands of consumers in another 2 days though both newly released devices and ROM updates for existing devices.  Most Windows Mobile devices will have the Marketplace preinstalled (though a few months ago it was reported that Verizon Wireless has decided that the Marketplace would not be included on their devices).

Windows Mobile 7 Supports Vector Graphics

Windows Mobile 7 has support for vector graphics.  That will address a lot of the concerns that many developers had about targetting multiple resolutions and creating graphical resources for each one. Where did I hear this? At the Windows Mobile Developer camp in Mountain View, California, USA. The event is still going on now, but when the videos are posted I will post a link to them.

Detecting Storage Cards

Some time ago in the MSDN forms I responded to a few questions on how to detect the storage cards in the file system and how does one get the storage card's capacity. I wrote the following could are a response to those questions and thought it would be helpful to share.  Storage cards show up in the file system as temporary directories.  This program examines the objects in the root of the device and any folders that have temp attribute are considered to be a positive match

using System;
using System.IO;
using System.Runtime.InteropServices;

namespace StorageCardInfo
{
  class Program
  {
    const ulong Megabyte = 1048576;
    const ulong Gigabyte = 1073741824;

 

    [DllImport("CoreDLL")]
    static extern int GetDiskFreeSpaceEx(
       string DirectoryName,
       out ulong lpFreeBytesAvailableToCaller,
       out ulong lpTotalNumberOfBytes,
       out ulong lpTotalNumberOfFreeBytes 
    );

    static void Main(string[] args)
    {
      DirectoryInfo root = new DirectoryInfo(@"\");
      DirectoryInfo[] directoryList = root.GetDirectories();
      ulong FreeBytesAvailable;
      ulong TotalCapacity;
      ulong TotalFreeBytes;

      for (int i = 0; i < directoryList.Length; ++i)
      {
        if ((directoryList[i].Attributes & FileAttributes.Temporary) != 0)
        {
          GetDiskFreeSpaceEx(directoryList[i].FullName, out FreeBytesAvailable, out TotalCapacity, out TotalFreeBytes);
          Console.Out.WriteLine("Storage card name: {0}", directoryList[i].FullName);
          Console.Out.WriteLine("Available Bytes : {0}", FreeBytesAvailable);
          Console.Out.WriteLine("Total Capacity : {0}", TotalCapacity);
          Console.Out.WriteLine("Total Free Bytes : {0}", TotalFreeBytes);
        }
      }
    }
  }
}

 

 

 

.Net Micro Framework 3.0 Released

The .Net Micro Framework version 3.0 is now availble.

  • Compatibility with Visual Studio 2008 and C# Express
  • Touch Screen and Gesture Support
  • Ability to Act as USB Accessory for PC
  • WiFi and SSL Support
  • Emulator included with Kit

For me the most significant feature of this release is the support for Visual Studio 2008.  When I checked the hardware page I saw that the .Net Micro Framework kit that I have is compatible, so I can uninstall VS 2005 and free up some hard drive space. For those curious there is a video in the "Getting Started" section of the

Download the SDK Today!

.Net Micro Framework Resources

Spark Your Imagination

The third Windows CE related contest to come up in the past several weeks is titled "Spark Your Imagination."  The grand price is $15,000 and a trip to TechEd 2009. The contest is divided into three rounds.  In the first round you must submit a 1 to 3 page paper describing a home automation project.  If you are one of the 50 chosen finalist you will receive a Via Artigo Pico-ITX hardware kit to construct your idea, write a 4-5 page paper on it, and make a three minute video about it.  The three top finalist receive $1,000 and a flight to Silicon Valley to demonstrate their idea at a Microsoft Keynote.

What Tools do I Need to Develop for Windows Mobile?

Several times in the past two weeks I've seen users on the MSDN forum ask what software tools are needed to develop for Windows Mobile.   It's possible to develop for Windows Mobile devices using the .Net Compact Framework SDK and the command line compiler.  I would never suggest that some one do that; IDEs provide a much better debugging and development experience. The chart collowing this paragraph will let you know what versions of Visual Studio that you can use for each Windows Mobile and .Net version.  Note that no Visual Studio express version is lited here.  

Visual Studio VersionSupported Windows Mobile Versions
Visual Studio .Net 2003 Supports .Net Compact Framework 1.0 for Pocket PC 2002 and Windows Mobile 2003
Visual Studio 2005 Standard Edition or Better .Net 1.0 and .Net 2.0 from Windows Mobile 2003 to Windows Mobile 6
Visual Studio 2008 Professional .Net 2.0 and 3.5 from Windows Mobile 5 to Windows Mobile 6

Programs that you cannot presently use for Windows Mobile development include the express editions of Visual Studio and Visual Studio 2008 Standard.

Windows Mobile Current Directory

Another area when programming on Windows CE/Mobile devices is "How do I find the current directory?"  CE devices don't have a concept of a current directory.  This means that relative paths don't have meaning on a CE device (all paths are absolute).  Because of the lack or relative paths  some files (such as help files) are loaded to the Windows directory (personally I absolutly hate copying anything specific to an application to the Windows Directory).

It follows that since there is no concept of a current directory on a Windows Mobile device how would one locate a resource for which only a relative path is known?  A .Net program always has access to the modules of which it is composed (usually a .Net component is composed of one module packaged in a DLL or EXE file). The following line will return the absolute path to the currently executing assembly.

 string modulePath = this.GetType().Assembly.GetModules()[0].FullyQualifiedName;

 To get the absolute path to the folder that contains the assembly simple string manipulation is required.  The assembly name appears after the last directory seperator. While the directory seperator is usually the backslash (\) character, for better compatibility across other operating systems that may run .Net (ex: Mono[^] on Linux, OS X, or Solaris) use System.IO.Path.DirectorySeparator to represent the directory separator charactor.

string solutionFolder = modulePath.Substring(0, modulePath.LastIndexOf(Path.DirectorySeparatorChar) );

Once the folder to your program is known use Path.Combine to build the fully qualified file name for files in your folder.  Path.Combine takes into account the directory separator for the operating system on which your program is run.  So if you had data in a file named MyFile.txt you would use

string myFilePath = Path.Combine(solutionFolder,"MyFile.txt");

Update 1 : I received a simpler way to accomplish the same thing from John Spraul in the comment section.  Thanks. John!

Update 2: If you are developing using the native APIS use the following:
GetModuleFileName(GetModuleHandle(NULL),    pszFullPath, MAX_PATH);

Path.GetDirectoryName(this.GetType().Assembly.GetModules()[0].FullyQualifiedName)

or

Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName)

if you do not want to load the type.

My CE Devices

I had to pull out one of my older Pocket PCs for testing something and while I was at it I decided to round up my Windows CE devices and take a picture of them together.  I seem to have quite a bit.  Missing from the history of devices that I've owned are an i-mate Jam and the ViewSonic V37.  Regretably I sold one and gave the other to some one that wanted a PocketPC.  I hope to get a Windows Mobile 6 standard device and a Windows CE development kit in the coming months.

 

My Windows CD Devices