Home About Me Follow Me on Twitter @mikefrancis Subscribe Resources
# Friday, July 24, 2009

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

posted on Friday, July 24, 2009 6:14:47 PM UTC  #    Comments [0] Trackback
# Thursday, July 23, 2009

At the risk of sounding like Billy Mays (may he RIP) – I got a huge deal on an 8GB microSDHC card. It’s incredible how much memory has come down in price. Five years ago I thought that $70 for a 64 MB card was a good deal. Can’t wait to put this in my Blackjack II – this will give my 8GB Zune some competition.

Transcend 8GB Micro SDHC Flash Card

Here is the link: http://www.newegg.com/Product/Product.aspx?Item=N82E16820208453

posted on Thursday, July 23, 2009 3:40:13 AM UTC  #    Comments [1] Trackback
# Wednesday, July 22, 2009

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: , ,
posted on Wednesday, July 22, 2009 8:24:00 PM UTC  #    Comments [0] Trackback
# Tuesday, July 21, 2009

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: ,,
posted on Tuesday, July 21, 2009 2:40:59 AM UTC  #    Comments [0] Trackback
# Tuesday, July 07, 2009

I’ve just installed dasBlog on my Adhost account. I like dasBlog since it runs under medium trust level and does not require a database for setup. It’s also free and works well with Windows Live Writer. See here for configuration tips.

Here’s a test image:

PIC-0006

Mike

posted on Tuesday, July 07, 2009 6:38:07 PM UTC  #    Comments [4] Trackback