Archive for the ‘code’ Category

New file and directory open and save dialogs for Windows Mobile

Tuesday, November 20th, 2007

Windows Mobile – like standard Windows – has a default “file open” and a “file save” dialog that all applications can use. If you’re writing an app, you can use it in your code with just a few lines. Great!

Except… no. Because they’re rubbish.

This has come up as an issue raised with a couple of apps that I’ve written that use the standard dialogs. I would defend my apps by saying that I didn’t write the dialogs, and that they’re the same that you get in other Windows Mobile apps like Microsoft Word Mobile. But I can’t, really. For a user, this is just an excuse. Wherever the dialog came from, it is rubbish.

I’ve written a couple of new ones for use in my applications. They’re fairly small, so I’ve made them available if anyone else wants to use them with their apps.

In this post, I’ll quickly outline what is wrong with the standard dialogs, and introduce my new ones.

(more…)

Registering file extensions with Windows Mobile apps

Tuesday, November 20th, 2007

I took a break from playing with the Android SDK for the first time tonight by making a quick update to my Windows Mobile notepad app.

Previously, to open files I’ve had to launch the notepad, then use File -> Open and choose my file. I wanted to register the .txt file extension with the notepad app, so that I can open files in the notepad by clicking on them. It’s a fairly straightforward thing to do, but I thought it might be helpful to share.

I couldn’t find much information about it, but it’s fairly simple to work out if you use Visual Studio’s Remote Registry Editor to see how other apps do it.

(more…)

Shortest app yet – Windows Mobile reset

Tuesday, October 23rd, 2007

I have to reset my Windows Mobile PDAs depressingly often. Both the HTC Universal and Advantage seem to need resetting every other day or so.

This has one big problem. You can lose stuff if you’re not careful. From Windows Mobile 5 onwards, a lot of data is kept in memory for performance reasons – written to persistent storage periodically. If you reset before this has been done, you can lose the most recent data.

For example, if I get a text message, then reset the phone, that text message will almost certainly be lost.

The trick is, if you need to do a reset you switch the phone off, leave it for 20 seconds then reset it. Normally, after being idle for a bit the phone will write pending data to storage.

This is a bit unscientific, so (after losing stuff from Outlook again today) I looked for a software way to ensure recent stuff is saved.

(more…)

A PowerShell command you should avoid

Tuesday, October 23rd, 2007

While I was writing my presentation on PowerShell, I did one spectacularly dumb thing which I thought might be fun to share.

I was doing some screen-captures for use in slides, to show how you can stop a process.

What I meant to type was:

Get-Process notepad | Stop-Process

Get me all of the notepad processes, and pipe them to Stop-Process which will stop them.

But stuck deep in PowerPoint slide-producing-hell, my fingers ran quicker than my brain and what I actually typed was:

Get-Process | Stop-Process

Crap.

Fancy taking a guess what that did?

(more…)

An introduction to mobile development on Windows Mobile

Tuesday, October 23rd, 2007

Another day, another HackDay presentation. This one is a little more lightweight than yesterday (a breakneck crash course through learning how to use and extend PowerShell).

It’s basically a beginner’s guide to mobile development – some scene-setting and a few walkthroughs how to do “Hello World”-type stuff with the key Windows Mobile libraries.

Hopefullly will be interesting to someone!

I guess I’ll know in about an hour 🙂

An introduction to Windows PowerShell

Monday, October 22nd, 2007

Later today, I’m giving a presentation on Windows PowerShell as a part of the lead-up to this year’s internal IBM HackDay.

It’ll be good to address some of the misunderstandings I had about PowerShell when I wrote about it before. In the presentation, I will be giving an introduction to Windows PowerShell – what is it, and how it works.

I’ll also be talking about how you can extend it to provide support for administering your own product or project (which is where the HackDay element comes in – hopefully to encourage some PowerShell projects!).

Impatient people can get a sneak peek at my slides here…

(more…)

Getting the currently selected text from Pocket Internet Explorer

Saturday, October 6th, 2007

As part of my hack for mobileCampLondon, I wanted to get the current selection from the web browser on my Windows Mobile phone.

The plan was to add a new menu item to Pocket Internet Explorer that lets you search for the text you’ve selected in Google. So I needed to get the currently selected text in order to include it in a Google search page URL. I thought it’d be simple, but it turned out to be more of a hassle than I expected.

My final approach is more of a hack than I’d have liked, so in this post, I’ll outline my unsuccessful approaches before showing what I finally ended up doing.

(more…)

Process your emails – an Outlook plugin

Thursday, September 13th, 2007

I got a nice email last week from someone asking why I never made the “triage” Outlook plugin I mentioned last year available as I have with other bits of code. The short answer was obviously because I never got round to finishing it! 🙂

However, the idea feels a bit more topical at the moment so I think it is worth revisiting.

The aim was to create something that would let me process my emails in Outlook Mobile (the cut-down version of Outlook you get on Windows Mobile PDAs and smartphones).

“Processing”, rather than doing emails is an idea that I hear people mention more often since Merlin Mann’s brilliant Inbox Zero talk started doing the rounds as a Google video. I’m even hearing other people use it as a phrase from time to time! I used to call it “triaging” my email, but I think “processing” is actually a better term. Either way, the idea is that I want to be able to go through my inbox as quickly as possible – doing something with each one so that I can finish up with an empty inbox.

Inbox ZeroIt doesn’t mean doing everything right away – just putting the information in it’s right place. If it’s an email asking me to do something, the right place for the email is in my Task List, not my Inbox. If it’s an email telling me about a meeting or appointment, then the right place for the email is in my Calendar. If it’s an email containing information that I need to keep for future reference, then the right place for it is in my wiki.

Mobile phones seem like an ideal tool for processing email, as it’s something that you can do when you have a few spare minutes and without having to do a lot of text entry or other input. Rather rely on manual (and slow!) copy-and-pasting, I wanted Outlook Mobile to be able to move my emails around like this for me. This was the idea of the plugin…

If you are interested in the pain of writing MAPI plugins in C++, read on. If you are… erm… normal – then the short version is that I tidied up the code and made it available.

(more…)