Off to plan a Greek wedding

Sun, April 1, 2007, 07:57 AM under Personal
I am off to Greece for a couple of weeks on holiday. Well, I say holiday but actually it is to sort out some stuff for our Greek wedding (the religious version)... for those that haven't done it yet, planning a wedding is time consuming in its own right, but planning one remotely is very stressful indeed - my advice is simply don't!

Anyway, normal business will resume on April 17th or thereabouts...

MEDC 2007: Six loaded reasons to attend

Sat, March 31, 2007, 02:18 AM under Events
This year's Mobile and Embedded Developers Conference is promising to be the best ever. Now, anybody that knows the passion I have for this stuff may be thinking "Yeah, you would say that though, wouldn't you?". So don't take my word for it, think about it based purely on facts (in random order):
1. MEDC 2007 is the first major event since the launch of Windows Embedded 6.0 and .NET MicroFramework. Just imagine the content that will be available there on those two products and don't forget XP Embedded!
2. MEDC 2007 has tons of content for Vista on the Mobile PC story (including SideShow) and also on the next web platform from Microsoft: LIVE (you didn't think LIVE was irrelevant to devices did you?!)
3. MEDC2007 is the first developer event since the launch of Windows Mobile 6. While the WM6 SDK is available, for MEDC there will be an update to it and I am hopeful for what will be included from a managed developer's perspective :-)
4. MEDC 2007 is the first time we will get an in-depth look at .NET Compact Framework 3.5 and at Visual Studio for Devices in "Orcas".
5. MEDC 2007 is in the coolest city on the planet: Las Vegas! And if you are not into all the glitch and partying, there is one awesome reason to visit the area. Take an extra day (e.g. Sunday or Friday) and visit the Grand Canyon next door - it is simply breath taking (or Hoover Dam just a short drive away).
6. MEDC 2007 is hosted during the exact same period and at the exact same hotel as MIX 07. Not only you can get a huge discount if you attend both conferences (plus a copy of Vista Ultimate at MIX), but just imagine what happens when a whole bunch of mobile and embedded geeks are collocated with a bunch of web and designer geeks. Only goodness can come out of that :-)

No excuses dudes (and dudettes), just go register first and seek permission later!

I'll be on stage every day at least once, but don't let that put you off :)

Vista native stuff for WPF

Fri, March 30, 2007, 11:11 AM under Vista | Windows
When I do my talk showing how to call Vista-only native APIs to enhance your Windows Forms applications on Vista, occasionally someone asks about achieving the same in Windows Presentation Foundation (WPF). My answer is always the same of course: "WPF does not include any Vista-only APIs so you still have to pinvoke for the features that I demonstrate."

For example, many features rely on overriding the WndProc method to hook into the main message loop and deal with some windows message (WM_):
  protected override void WndProc(ref Message m)
{
// e.g. deal with message for
// composition changed, power state notification, restart manager aware etc
}
In WPF you can achieve that with code like this:
       void Window1_Loaded(object sender, RoutedEventArgs e)
{
source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
source.AddHook(new HwndSourceHook(WndProc));
}

private static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
// TODO handle WM_
}
While the previous statement/reply/example is true, some of the things I show in my talk rely on using a control's handle. For example, adding a shield to a button (for UAC), the new button style known as CommandLink, TextBox cue banner, Vista TreeView etc. In those cases, for WPF you can't use pinvoke to SendMessage or subclass the control (Get/SetWindowLong etc) since the WPF controls are drawn from scratch. Instead, you have to manually draw the effect you are after. The Windows SDK has an example of a CommandLink fully drawn for WPF but I couldn't see any of the others (e.g. a button with a shield) so this is a great opportunity for a WPF developer to flex their creativity muscles and create the Vista control behaviours/appearances for WPF (since pinvoking doesn't help there). Be sure to let me know if you get round to implementing anything like that in the public domain...

Photoshop Preview Handler

Fri, March 30, 2007, 09:51 AM under Windows | Vista
Regular readers will recall my blog entries about managed preview handlers on Vista. Rajesh dropped me a comment pointing to his codeproject article. Let him know what you think.

One of the aspects I like about his preview handler is that it uses a tooltip to offer more info. Regardless of how easy/hard the visualization of a file is, adding a tooltip for extra info is a simple yet awesome idea IMO - good job!

Orcas for Web developers

Wed, March 28, 2007, 11:25 AM under Orcas | VisualStudio
My colleague MikeO looks after the web space here in the UK and he started a list of what is new in Orcas here.

Inspired by his list I searched the blogosphere (yeah that word makes me cringe too...) and found more on the three things that caught my eye:
1. Script intellisense (here)
2. New web form designer (here)
3. Better CSS support (here)

If you are a web dev, stay tuned for more Orcas goodness by following those 4 blogs above...

Of course other generic aspects of Orcas apply equally to the web story such as multi-targetting and LINQ.

UK User Groups

Wed, March 28, 2007, 10:14 AM under Events
I love it when I can answer two questions with a single answer (it's all about reuse :-)).

Delegates at our MSDN events sometimes ask about how to find local groups where they can attend technical events, not necessarily organised by Microsoft. Also speakers from other countries often ask me about speaking opportunities when they visit the UK. To both I say, visit the UK User Groups list here. Follow the links to see what type of events each user group usually holds, locations they cover (usually more than one) and get in touch with the UG leader - simple.

If you currently run a user group in the UK and you are not listed on the page above, take action now. If you are listed on the page above and are looking for a Microsoft speaker to come to your event, take action now. In both cases the same action should be taken: email our lovely leader of community leaders, Clare Parr (clarepa at microsoft dot com).

An example of a user group not listed up there yet, is a spanking brand new one holding its first meeting next month: .NET Developer Network.

Visual Studio for Devices features in Orcas

Wed, March 28, 2007, 09:35 AM under MobileAndEmbedded
While we looked at new features in NETCF 3.5 for the device developer, there are also tons of improvements in the IDE (VSD "Orcas"), the top 5 IMO being:

1. Unit Testing for Devices
Note that this also works for v2.0 device projects in Orcas too, yay!

2. New Project dialog

3. Device Emulator v3
This has all the goodness of Device Emulator v2.0 plus it can be automated/scripted via COM - the clue is the DEMComInterface.idl file in your DE installation directory.

4. Device Configuration Manager & Device Certificate Manager
Previously available as a powertoy for WM5. To see them in action, from your VS Orcas Tools menu, select Device Security Manager:


5. Windows Mobile 5 SDKs and .NET Compact Framework v2.0 SP2 in the box. No more need for separate downloads :)

New project dialog for VSD in Orcas

Wed, March 28, 2007, 09:16 AM under MobileAndEmbedded
UPDATE: After Beta 1 I updated the text below with a new addition/screenshot and struck out the inapplicable text (bug fixed).

Nick blogged about this first, and Neil followed. Both have screenshots on their blogs so check them out.


If you ask me, we needed this simplicity for newbies to device development because the old approach was way too confusing. Having said that, previously I could create any project type in two clicks and now I need a lot more; so penalising the expert user is definitely the case here IMO. Rule number one of UI development: less clicks is good. Rule number two: offer two navigation paths: one for the novice, one for the expert.

Regardless of the above, before Orcas RTMs, we have to fix the combobox behaviour: When I select NETCF version 2.0 in the bottom combobox and then select a platform in the top, why the heck does the value in the bottom combobox revert to the default of 3.5? Rule number three of UI development: If I have made selection, don't revert it based on another selection on the same dialog! What makes it worst in this instance is that when selecting something in the top combobox, the bottom combobox is hidden out of view so the change goes unnoticed unless you are looking for it.

Also, again regardless to the above, I would expect those combobox values to be remembered between different launches but unfortunately they are not (yet?).

As of Beta 1, the dialog has a new addition at the bottom: a hyperlink to get new SDKs (e.g the WM6 SDKs).

html Save As in IE7 produces htm

Wed, March 28, 2007, 08:05 AM under IE7 RSS
A couple of people had trouble recreating my sample gadget and it turns out that the issue was with the HTML file I posted. In IE7 when right clicking on the link and selecting "Save As", the dialog that comes up saves it as HTM. This of course will not work since the manifest file that you download points to an HTML file, not an HTM file. So please rename the file to its full extension after downloading. Note to self: always upload HTM files rather than HTML files to help IE7's "issue".

One reader also got a corrupt manifest XML file somehow and the culprit there was the embedded copyright symbol that I have now removed from the file even though it hadn't caused me any issues…

Please use the Restart API to its full potential

Tue, March 27, 2007, 02:10 PM under Windows | Vista
I've been meaning to rant about this and Sahil gave me the incentive with his wish list for IE8 and Vista.

The 2nd wish item on his list for Internet Explorer is:
"When IE crashes, there should be an option for it to restore state, i.e. re-open the tabs I had opened when it crashed."
IE7 has crashed on me in the past and I do recall the behaviour that Sahil is referring to which, for those of you not running Vista, is that IE7 restarts so you don't have to restart it yourself :-). Cool, but IE7 restarts with the default home page(s), instead of opening my last browsed tabs and that is not cool. The reason this really gets to me is that I know it is so darn easy to implement the feature!

In fact, the Restart API is an area where unfortunately I am seeing a pattern of our product teams taking advantage of only half the feature (the restart bit, without the restoring state bit). The Visual Studio Codename Orcas March CTP is an application that made me smile in a very positive way when it crashed on Vista (where it is not supported) and I observed that it restarted after sending the error report. But again to my dismay, it simply restarted and left it at that. Hopefully by the time it ships, the team will implement the rest of the feature so when it restarts it also attempts to open the last solution I was working on.

Now, there is a (weak) argument either of the teams above can make that goes as follows: "If when we restart, after a crash, we try to restore the last opened tab/project, then we run the risk of ending up in a cyclical restart". This is a weak argument for two reasons:
1. The API can protect you against cyclical restarts (look at the 2nd parameter of the function from the link above and also the 60 second rule I describe in the video linked above)
2. I would expect dialog that has words to this effect: "We are sorry you experienced an issue with this application, an error report has been sent. Would you like to open the last solution/web page you were looking at? NOTE: This may cause the application to crash again!". And after displaying that message, if the user chooses to continue and they crash again, the next time don't put up the dialog and don't try to restore state.

This isn't rocket science. We have a fantastic feature in Vista; the teams have started to take advantage of it but just falling short in the end. IE7 has shipped of course, but I remain hopeful for "Orcas" to be smarter about this by RTM...