Vista: ActiveSync replacement

Fri, June 16, 2006, 08:57 AM under MobileAndEmbedded
There was a pleasant surprise on Windows Update this morning, a Beta update of the Windows Mobile Device Center that I talked about last month. After downloading it I captured some screenshots below (some are behind the hyperlinks and others inline with the body).

First connect a WM device or you'll get different screenshots since the UI options are visible only when applicable.

First screen offers us two options. The first one sets up the partnership and the second looks like this:


Hovering over any of the 4 areas, exposes further options: Programs and Services, Pictures Music and Video, File Management and Mobile Device Settings.

The Programs and Services option has two sub-options: One takes you to the windowsmobile home page on microsoft.com; the other option allows you to add/remove programs via this dialog:


The Pictures Music and Video option has 3 sub-options: one shows you how many "new pictures/video clips are available for import"; the last one launches a wizard from Media Player so you can "add media to your device from windows media player"; the middle option offers the following dialog "picture video import settings":


The File Management option doesn't seem to have changed from the one I captured last time.

The Mobile Device Settings option shows connection settings and of course the one we've all been waiting for: Setting up partnership (which I'll have more on later :-)

Vista: Glass

Fri, June 16, 2006, 03:00 AM under Windows | Vista
One of the new "features" of Windows Vista is: glass. Title bars and borders on windows (i.e. the non-client area) now have a transparent glass effect. Assuming your graphics card is powerful enough to support it you must choose the "Windows Vista Aero" colour scheme under Appearance Settings and you've got glass ability:


If you don't have the aero option, go to "Control Panel-> System and Maintenance -> Performance Rating and Tools" and Refresh your rating [if even that doesn't do it for you, buy a better graphics card or lower your resolution or search the net but please do not email me for help in this particular area as this is all I know :-)]

You can control whether the glass effect is transparent or not (it looks good even when not transparent), and further control the intensity of it and the colour that the glass is based on. The control panel for these options looks like this:


While aesthetics is one of the goals that the glass effect scores, it achieves a usability goal that, admittedly, you only appreciate after living with Vista for a while: it makes you naturally focus on the content of the window, the main area, rather than anything else; it draws your attention to the solid, useful bit in the middle of the window.

Some applications have taken the aforementioned benefit further, by extending the glass effect into the client area of their windows. An example of that is the Control Panel, Document Explorer and Internet explorer (they have extended the glass area from the top of the window):


Another example is Windows Media Player (it has extended the glass from the bottom of the window):


And finally, the Sidebar Gadget Gallery has gone all the way as it has extended the glass from top to bottom (or bottom to top if you prefer):


Note that in all the previous applications/windows, you can move the window not only by holding down and moving the mouse on the title bar but also in any glass area. I don't know if this is a guideline but it should be (if it is, Windows Photo Gallery doesn't follow it). A few applications offer the ability to move a window by clicking on areas other than the title bar and it would be good to standardise on that area being glass. It would work the other way too by implicitly letting people know that "any glass area of a window can be used to drag the window".

So what is all this information doing on a developer blog? It simply provides background for when I show you how to use glass in your managed applications, next.

Windows Vista in Newcastle

Thu, June 15, 2006, 08:17 AM under Events
Those of you in the north of UK and in particular the Newcastle vicinity are invited to my session at VBUG.

Go register now. Even if you are attended our roadshow, in this session we'll have twice the time to explore the developer story on Vista *beyond* .NET Framework v3.0 (in other words, native Vista-only APIs via managed code :-)

Details here.

Register for my webcast

Thu, June 15, 2006, 08:10 AM under Events
Many of you have caught my session ".NET Compact Framework for Desktop developers" in Horsham, London and Athens. You will have also caught my variation of that in Dublin and yet another variation in Las Vegas. Well, now is your chance to attend it online :-)

If you are a .NET dev with ZERO previous knowledge on .NET Compact Framework or mobility, go register now!

Wednesday 5th July
17:00 GMT
(09:00 AM Pacific Time)

Details here.

.NET Framework v3.0

Thu, June 15, 2006, 07:59 AM under dotNET | dotNET
Ever since the announcement about the renaming of WinFX to .NET Framework v3.0 there have been many blog entries on the topic. Some we can ignore as they are of the "me too" variety e.g. "Here is the announcement. End of Message" or "This is good. End of Message" or "This is bad. End of Message". There have also been some posts about how "This is good. And the reason is X". Where X is usually something sales/marketing orientated; since we are developers, let's ignore those too.

So what are we left with? We are left with a subtle message that many seem to have missed (more on that in a minute) and also with some posts that are simply missing the facts so let's first get the facts right:

1. This is just a name change. Nothing more, nothing less. No schedules have changed, no content has changed, no direction has changed, and no relevant follow up announcements are planned. The technology formerly know as WinFX is now NETFx v3.0

2. It is not named ".NET 3.0". It is named ".NET Framework v3.0". This is more important than what you might think.

3. I have always described .NET as the CLR/engine, the framework/libraries, the compilers/languages and the tools/VS
a) .NET Framework v3.0 doesn't *change* any of that.
b) .NET Framework v3.0 simply *adds* WPF, WCF, WF, WCS
c) It does not add LINQ, Orcas or anything else

4. After .NET Framework v3.0 is released (with Windows Vista as has always been the plan) when you try to install it on XP SP2 it will bring all the v2.0 bits with it. If you have those bits on the machine already, it will simply add the 4 that you are missing.

If you grasp all of the above facts but still want to have discussions about the choice of name then I don’t see the point. Microsoft's marketing department has never picked the right name (as far as developers are concerned) for any of the released technologies. If we look at this, then it either means that developers are never happy _or_ it means that Microsoft marketing will never get the names right so, again, why bother? Just focus on the technology!

Now on to the more interesting IMO observation:

This effectively signifies the beginning of the end of bundled versioning. I look forward to the day where I get updates to the tools without having to wait for a new version of the CLR or getting some library bits without having to wait for the final RTM tools... Decoupling of release schedules brings us the bits when they are ready without having to wait for various groups to align with each other (which inevitably results in delays). The challenge now is to see how well this works going forward. Ask me again in a year…

Vista: TaskDialogIndirect

Mon, June 12, 2006, 06:38 AM under Windows | Vista
You know about my simple managed wrapper of the simple version of the new TaskDialog API. I was going to go ahead and implement a wrapper for the advanced version (namely TaskDialogIndirect) but it seems that VistaBridge does that already).

I knocked up a new winforms app with a button that references the wrapper library, and I then setup as many options as I could on the TaskDialog. The results are ugly but do demonstrate some of the power of TaskDialog:


The code responsible for that follows:


Enjoy!

VistaBridge

Mon, June 12, 2006, 06:35 AM under Windows | Vista
You are a managed developer, with Vista Beta 2 and you also have the SDK (which you know from my Vista Links).

Now run (don't walk) to your Vista machine and do the following now:
Unszip [your drive letter]:\Program Files\Microsoft SDKs\Windows\v1.0\samples\CrossTechnologySamples.zip and browse to the VistaBridge folder and open the solution. If you have two projects in the solution then great, one of them is the Windows Presentation Foundation demo app. If one of the projects failed to load for you then you don't have the WPF Beta 2 bits installed. Not to worry though as the project that did load is the managed class library that you are interested in and it seems ok without the WPF bits. It wraps a few cool native APIs!

I found this by accident while searching my hard drive for one of my TaskDialog files but more on that next...

TextBox prompt

Sun, June 11, 2006, 06:44 PM under Windows | Vista
I just discovered "prompt" for textboxes (no medal required, thank you :-)).
The inspiration to dig into it was the mention in the Vista guidelines (scroll down to "Prompts").

So, you have empty textboxes and you need to prompt the user to do something and in some cases it makes sense to provide that prompt in the textbox while not making it part of the textbox text/content itself; when the user clicks on the textbox (gives it focus) or enters text into it, the prompt has to dissappear of course.

So if you have a windows form with a button and a textbox that has no text in it, put this code in the button_click event handler method:
Win32Api.SendMessage(
new HandleRef(textBox1, textBox1.Handle),
Win32Api.EM_SETCUEBANNER,
IntPtr.Zero,
"some prompt. click in the textbox to make me go away"
);
...and the constants you need are:
internal const uint ECM_FIRST = 0x1500;
internal const uint EM_SETCUEBANNER = ECM_FIRST + 1;
The good news seems to be that this is also available on XP, if we are to believe this msdn link.

It would be nice to have this feature on Windows CE so we could use it in our Windows Mobile applications where screen real estate is at a premium and having additional labels to describe the textbox is sometimes wasteful.

Recent and upcoming Events (plus helping yourself)

Wed, June 7, 2006, 04:43 PM under Events

MSDN Roadshow: 3 down, 3 to go.

In addition to presenting at events, I also attend many in a support/helper capacity. As such, I mingle with the crowd and get to hear what they think about our products. Recent such events were the DevDays event on security in London and the DDD III event in Reading (also look out for me at the Office DevCon in a couple of weeks).

Whether attending, speaking or helping, one of the unwritten "rules" is that I wear a Microsoft shirt. This means that I get many questions, some that I can answer on the spot and some that I take with me for follow up. While I respond to every query I get and am more than happy to listen, help me help you by trying the advice below :-)

1. Search MSDN. Write your question down as if you were going to email it to someone. Then pick out the words that your mom wouldn't understand and enter them in the search box. You'll be amazed at how useful the results can be. Sometimes we forget that we don't call it the Microsoft Developer Network for nothing.

2. Search the newgroups. If you don't find an answer, post your question to the newsgroups.

3. Use the forums.

My bet is that there are no .NET developer questions on our current technologies that the above route cannot answer... none!

Remember that ultimately, Product Support Services is the place where you can get help in an official capacity. Finally, your feedback is always appreciated on ladybug.

I wrote a similar blog entry in my MVP days (due to the high volume of directed email I received) with a particular focus on NETCF: Before you email me with a question


Vista: TaskDialog

Thu, June 1, 2006, 05:07 PM under Windows | Vista
One of the many new things in 'comctl32.dll version 6' is the TaskDialog.
A task dialog is similar to, while much more flexible than, a basic message box.

There are two variants of the TaskDialog the second of which is the one that gives you enormous flexibility and power. We will look at the first variant which, while being simpler, still offers advantages over the old MessageBox API :-)

When I say "look", what I mean is I will share my managed wrapper since TaskDialog is a native API only at this point.

First let's look at what the managed wrapper looks like in a Class Diagram (IWin32Window is part of the .NET Framework, of course):


Here is a VS2005 screenshot of intellisense when using our class:


My test harness looks like this:


And finally, here are a couple of screenshots of the end product:



You may download the sample project here (remember, this only works on Vista!).