Welcome to MSDN Blogs Sign in | Join | Help
Windows Mobile 6.5 Start Screen PNG Icon Display problem

Some developers are reporting a problem with the PNG icon not displaying in the Start screen.The usual symptom is that it does not show up immediately after installation but is seen after a device reset. This problem occurs if following the ...

Note: Cross posted from Mike Francis: My Mobile Home.
Permalink
Information about the Marketplace Client and Custom UI

I just posted on the Windows Mobile Developers team blog: The Windows Marketplace for Mobile Client and your Setup code. This article reviews some potential ‘gotchas’ if you include custom UI in your setup DLL that is being called by the Marketplace client. The message is, please don’t add custom UI. Why? Because it makes the install experience less uniform and streamlined. If you really, really must add you custom UI, the information in this post should be useful to you.

Enjoy,

Mike

Note: Cross posted from Mike Francis: My Mobile Home.
Permalink
New Blog: http://blog.mjfnet.com

I’ve setup my own blog in order to have more control over the presentation and since I develop, wanted to try embracing and extending a .Net based blogging platform.

I’ll continue to cross-post here.

Check out my blog at http://blog.mjfnet.com

Thanks,

Mike

How To: Creating Icons for Windows Mobile 6.5

Need to create PNG files for your Windows Mobile 6.5 applications? Check out my blog post on the main Windows Mobile blog here.

Mike

Windows Mobile 6.5 Web Browser Control: Enabling Selection support

In my previous post (Windows Mobile 6.5 Web Browser Control: Enabling Gesture support), I discussed how you can enable the built-in gesture support of the web browser control in Windows Mobile 6.5.  Basically you disable selection support when creating the control, and the gesture support is enabled. But what if you want to select within the control. It seems that selection and gestures are mutually exclusive.

Yes. You can’t select and use gestures at the same time. However you can switch into ‘selection mode’ when needed. The following video shows the how this is used in the Windows Mobile messaging application:

 

In this video, I use gestures (flick) to scroll down the email message to locate a block of text I want to copy.

To get into ‘selection mode’, I press Menu | Make Selection. I then select the block of text, tap and hold to bring up the context menu and press Copy.

 

 

 

 

To add this functionality to your Web Browser control application, we will need access to the controls COM interface. Fortunately the ‘HTML control’ provides access to this via the DTM_BROWSERDISPATCH message. The following code demonstrates how to access the IBrowser3::put_SelectionEnabled method to enable / disable ‘selection mode’:

HRESULT SetSelectionMode(HWND hWndHtml, BOOL bSelect)
{
LPDISPATCH pDisp=NULL;
// Get the dispatch interface
SendMessage(hWndHtml, DTM_BROWSERDISPATCH , 0, (LPARAM) &pDisp);
if (pDisp==NULL)
return -1;
// The put_SelectionEnabled method is included in the IBrowser3 interface
IBrowser3 * pBrowser3;
HRESULT hRes = pDisp->QueryInterface(IID_IBrowser3, (LPVOID*)&pBrowser3);
hRes = pBrowser3->put_SelectionEnabled(bSelect ? VARIANT_TRUE: VARIANT_FALSE );
pBrowser3->Release();
return hRes;
}

So where does the IBrowser3 interface come from? This was supported in an earlier version of the browser, but has since been deprecated. However, the control is still using this interface. The interface definition is located in

C:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\PocketPC2003\Include\webvw.h

I copied this over to my project directory and renamed it: webwv2.h

You can download the BrowserWithGestures sample code project (VS2008) here.

Note that the information above is not documented by Microsoft and is therefore not supported. (i.e. if you call Microsoft Developer Support you may be turned away since only documented / published APIs are supported.)

del.icio.us Tags: , ,
Windows Mobile 6.5 Web Browser Control: Enabling Gesture support

One of the most powerful controls in the Windows Mobile developer toolbox is the Web Browser control. With this control, you can create applications as simple as displaying HTML, to more complex apps that interact with the DOM manipulating elements, and fining / responding to events.

The introduction of touch and gesture support in Windows Mobile 6.5 has greatly improved the user experience. You can now intuitively flick and pan with your finger in most of the Microsoft applications and your own! Adding gesture support to your application is not trivial. See the Windows Mobile 6.5 Developer Tool Kit (DTK) for more information.  Fortunately Microsoft has included gesture support in the Web Browser control for 6.5

There are actually two web browsers in Windows Mobile 6.5. One that is used by Internet Explorer Mobile and another that is used by applications hosting the Web Browser control. This post will focus on the later.

There are two ways to instantiate the web browser control. The first method uses a COM interface to create the control. (See the miniPie SDK sample.) The second method hosts the control as a child of a DISPLAYCLASS window (The docs refer to this as the ‘HTML control’). In order to create this control with gesture support, you create it with the HS_NOSELECTION flag. For example:

hWndHtml = CreateWindow(TEXT("DISPLAYCLASS"), NULL,
        WS_VISIBLE | HS_NOSELECTION,0 , 0, GetSystemMetrics(SM_CXSCREEN),
        GetSystemMetrics(SM_CYSCREEN), hWnd, NULL, g_hInst, NULL);

You can see this for yourself:

  1. Open the Browse SDK sample
  2. Add the HS_NOSELECTION flag (as shown above) to the DISPLAYCLASS CreateWindow call
  3. Build and Run

In the video below, I changed the sample to load an HTML file that contained more than a screen full of data in order to force scrolling so that you can see the navigation via gestures (Flick and Pan):

Additional Resources:

Note that the information above is not documented by Microsoft and is therefore not supported.

del.icio.us Tags: ,,
Capture all Windows Mobile device keys using the AllKeys API

Norm Sohl points out in his post on the Windows Mobile Team blog that Microsoft is taking further steps to deprecate the GAPI APIs. Check it out here. Norm’s post includes a native code sample. Some folks have asked if AllKeys() can be used from managed code. The answer is yes. Here is the C# P/Invoke signature:

[DllImport("coredll.dll", SetLastError = true)]
static extern bool AllKeys(bool bAllKeys);

Mike

P.S. If you need to capture a specific key, see RegisterHotKey().

Top Developer Tips for Windows Mobile Webcast Follow Up – Q&A

MSDN WebcastHere a list of the questions and answers asked during Wednesday’s Webcast:

WILLIAM Asked:: In the real world there seems to be a much larger presence of iPhone and Blackberry touch screen mobile devices than Windows mobile touch screen devices. What are some suggestions for developing web applications that cover these devices that have the majority of the market as well as the Windows mobile devices?
Answer: Yes a good strategy is to develop for Standard (non-touch) since these apps will work equally well on touch devices – the reverse is not true.  Remember that non-touch devices are optimized for one-handed operation.

Hilary P Asked: Where are your DLLs? All I see is the text file ... are you writing/highlighting somewhere?
Answer: Open the dumpmem.txt file. Search for the following line:
1819F000  1141000 F NA
This is the largest free memory block and the bottom of the RAM DLL load area and the top of the program stack, resources, and heaps area. The DLLs are just below this line. The ‘Image’ lines belong to the DLLs.

D.P. Asked: understand the need for signing the apps... but can still distribute unsigned apps if they do not need signing... right?

Answer: Yes this is a strength if the Windows Mobile platform in that you can distribute your applications however you see fit.  However, you run the risk of your application not being able to be installed, if the mobile operator has configured the device to disallow unsigned applications from installing or running. Additionally you will run into the problems (mentioned in the webcast) of having the user to respond to prompts during installation, or mysterious failures during silent (Enterprise) installs. Most application resellers require that you have your application signed (Handango, Motricity) before they will carry it.

D.P. Asked: Are there any free (not vendor locked) APIs for putting code in ROM?

Answer: Only OEMs, not ISVs, can change the device ROM. Technically when you install an application is it stored in flash (ROM) memory.

EDUARDO Asked: nice all

Answer: Thanks!

Top Developer Tips Webcast Follow Up
MSDN Webcast Thanks for attending my MSDN Webcast today “Top Developer Tips for Windows Mobile”. As promised, here are a list of links mentioned in the talk:

Web Applications:

Download: Windows Mobile 6.1.4 Emulator Images (Includes Internet Explorer Mobile 6!)
Jim Wilson’s Blog: Wading through the challenges of ASP.NET AJAX and Windows Mobile

Smart Client Applications:
Virtual Memory:
Download: Dumpmem
Steve and Reed’s Blog: Slaying the Virtual Memory Monster and Slaying the Virtual Memory Monster - Part II
Download: Remote Performance Monitor
Download: Application Verifier

Adapt Your App:
MSDN: Adapt Your App
Automation Script for loading application into emulators: PowerShell and Quick UI Check for WM Applications

MSDN Windows Mobile Developer Center

 

Thanks for again for attending!

Look for a posting of the webcast Q&A in my next blog post.

Mike

Don't mess with Unlock Code sites - if you don't have to...

unlock.jpg

Want to use your Mobile Operator branded phone on a different network? You might not be able to. Why? Because many phones come SIM locked, preventing SIMs from other MOs from being used on those phones.

John Dvorak on is twitter feed (http://twitter.com/THErealDVORAK) asked, “Is there a good mobile phone site for unlock codes? I have a Nokia E-62 that needs its freedom.” This is a very popular issue for smart / cell phone owners these days. With a Windows Mobile SIM locked phone, like the Blackjack II, if you insert a non-ATT SIM into the phone, you will see the following error message:

"This phone can only be used with a specific SIM. Enter the unlock code or insert an approved SIM."

So what can you do? Prior to the ruling by the U.S. Copyright Office in November 0f 2007, you would have to use one of the third party web sites that sell unlock codes. However, the ruling allows cell phone users to legally break the software "lock" placed on their cell phones and move their phones from one carrier to another. This does not mean that the carriers have to unlock your phone, it means they cannot prevent you from SIM unlocking your phone. Some Mobile Operators, like AT&T will unlock your phone even if you are not a customer of theirs. Let me tell you my experience…

I am a T-Mobile customer and recently received an AT&T branded Blackjack II. To my disappointment, when I put in my T-Mobile SIM, I received the error message above. I had read about this ruling and heard that some MOs will give you the unlock code if you ask them. So I called AT&T Customer Care, pressed ‘0’ when prompted to enter my AT&T phone number and was routed to an agent. I explained to the agent that I had a Blackjack II phone that I would like to unlock. They did ask for my AT&T phone number and I told them I was not a customer and therefore did not have one. To my pleasant surprise, they asked for my IMEI number which is on the box, and then gave me the corresponding unlock code. Cool! I entered the unlock code in response to the prompt above and saw the sweet T-Mobile tag line “Get More…” on the home screen.

I would be interesting to know if this would work for removing the SIM lock from an iPhone or the T-Mobile G-1. Also, if you wish to resell your phone after unlocking it, you can advertise this, making the phone a more attractive purchase.

So long story short, before messing with unlock codes from web sites or other third parties, try calling the MO and ask them for the unlock code.

Microsoft Press - Visual Studio 2008 Free E-Book Offer
ms_linq_cvr ms_ajax_cvr ms_silverlight_cvr

Free book on LINQ, and teaser chapters on ASP.NET AJAX and Silverlight ...

Click Here: Microsoft Press - Visual Studio 2008 Free E-Book Offer

del.icio.us Tags: ,
How to Override the 'Back' Key in your Web Browser Control Application

I just helped a customer with a problem he was having with this web application : when correcting an entry in an edit field by pressing the 'back' key, instead of the last character getting deleted and the cursor moving one space to the left, the application would quit. This was very frustrating since the same scenario works with Internet Explorer Mobile. His application is using the Web Browser control to display the web pages that make up his application. The Web Browser control allows you to use the full power of Internet Explorer Mobile, with the ability to provide your own menus and to capture and respond to events from the DOM. The application is running on Window Mobile Standard 6.0 and 5.0. This is an important point since Windows Mobile Professional devices do not have a 'back' key.

'Back' Key causing App to Quit? 
     'Back' Key causing App to Quit?

So what is going on here? Why does 'back' in the Web Browser control not behave as it does in IE Mobile?  By default, the web browser control does not do any special handling of the back key. The default behavior of the back key is to activate the previously top level window in the Z-order. (His application was not actually quitting, it was just going to the bottom of the Z-order.) To duplicate the IE Mobile back key behavior you need to capture the 'back' key press, and forward it to the window that has the focus. Fortunately, the Windows Mobile SDK includes an API to do just that :  the SHCMBM_OVERRIDEKEY message and the API SHSendBackToFocusWindow(). I modified the SDK sample miniPie using the code below:

LRESULT CMainWindow::OnCreate(UINT /*uMsg*/,  WPARAM /*wParam*/
     LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
...

    // For devices that have a back key (i.e. Smartphones),
    // override the back key since we have an edit control 
    CWindow(mbi.hwndMB).SendMessage(SHCMBM_OVERRIDEKEY,
VK_TBACK, MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY,
SHMBOF_NODEFAULT | SHMBOF_NOTIFY)); ... return 1; // Let the system set the focus } LRESULT CMainWindow::OnHotKey(UINT uMsg, WPARAM wParam,
LPARAM lParam, BOOL& /*bHandled*/) { if (VK_TBACK == HIWORD(lParam)) // Smartphone-only { SHSendBackToFocusWindow(uMsg, wParam, lParam); } return 0; }
How Innovative! InnovateOn for Windows Mobile Development

This is a great deal for Windows Mobile Developers: Free Certification Testing and Code Signing Vouchers. Free Technical Support. These are a couple of the benefits of the just launched Innovate On Windows Mobile site: http://www.innovateonwindowsmobile.com

Enjoy!

PowerShell and Quick UI Check for WM Applications

Thanks to those of you that attended Reed and my presentation at the Windows Mobile Partner Summit. As promised, here is the PowerShell Script used in the demo. Click Here.

Here is a quick summary of the purpose of this script and how to run it.

Adapt your App: As you know, WM Professional now supports five different screen resolutions and three different DPIs. WM Standard supports two different screen resolutions and two different DPIs. (more info) Professional also supports dynamic screen rotation. The types of screens supported will very likely change in the future. Case in point: the HTC s720 (Standard) is the first Standard device to support dynamic screen rotation!

So how can you quickly test your application on several different screen types simultaneously?  You can leverage the Device Emulator Manager or the CoreCon .NET Class: Microsoft.SmartDevices.Connectivity, to test the application. The script here uses the later. For an exhaustive and informative discussion of the Device Emulator Manager, check out Jim Wilson's MSDN article here.

1. The script simply loads three emulator types:

240 x 320 @ 96 DPI, 480 x 640 @ 192 DPI (VGA), and 240 x 240 @ 96 DPI (Square)

I chose these to give good representation of the major screen types available. You could load more, but keep in mind each emulator image takes about 250 MB to load.

2. The script then waits for each image to connect and then copies the executable from the desktop to the emulator.

3. The script then launches the application on the emulator.

4. After the application launches, try pressing the Calendar button to invoke the screen rotation.

How does your app look? How can you fix it? Another great Jim Wilson blog post can help here.

Capture

Can you tell why this application does not display properly in the VGA emulator? (The source code can be found in the sample PocketOutlookSample that ships with the WM6 SDK.)

To use this script you will need:

  • Windows Mobile 5.0 or 6 SDKs
  • Windows PowerShell 1.0

    To run the script, from the command line:

    powershell .\emulator.ps1 [DeviceTargetDirectory\ApplicationName.exe]

    the device application should be in the same directory as the script.

    Thanks Loke Uei Tan for the inspiration here.

  • Hello World Wide Mobile Web

    Hi there! My name is Mike Francis. I've worked at Microsoft for twelve years in various roles including Technical Account Manager for Windows Mobile OEMs, Customer Support Services for C++, and now as an Application Developer Consultant (ADC) working with the Windows Mobile Development community providing advice, support, and best practices to developers worldwide.

    In this blog, I plan to share common problems and solutions as they come up while helping you, the Windows Mobile developer community.

    What's my primary WM device? Today its the T-Mobile Dash.

    Mike Francis

    Page view tracker