VS “Orcas” September CTP

Sat, September 30, 2006, 03:58 PM under Orcas | VisualStudio
One of the areas I will be focusing on as we move forward is the next version of Visual Studio code-named Orcas. So, when I got word last week (while on the road) that the 1st CTP was out, I couldn’t wait to come back home and play with it.

Unfortunately, it doesn’t look like I will be doing any playing :-( Not because this CTP doesn’t include all the LINQ bits or because it doesn’t include all the C# 3.0 bits or even all the VB9 bits. No, the reason I won’t be playing is because it is released as a VPC image that is not supported on Windows Vista. I just don't have any machines (or partitions) with XP on them (and quite frankly don’t want to ever go back to XP). Shame, as I was looking forward to playing with unit testing on devices and the other improvements for the NETCF developer.

Oh well, looking forward to the next drop and let’s hope there will be support for Vista (or that I decide to use Virtual PC 2007 Beta on Vista RC to test a CTP)!

If you can though, check it out and be one of the first to start blogging about what you like and what not. Download the Orcas September CTP here.

P2PMessageQueue queries

Sat, September 30, 2006, 09:36 AM under MobileAndEmbedded
Over the last year I have had a few people contact me with questions relating to the Point to Point Message Queue class I wrote for MSDN. This blog entry will serve as a URL where I can point future questions regarding it.

1. It seems that under certain circumstances, on certain platforms, the queue does not close properly. A possible solution is to declare a dedicated named event that you create in the ctor of the queue. Set it in the Close method. In the Monitor method, change the WaitForSingleObject to WaitForMultipleObjects and include this new event.

2. It also seems that under certain other conditions (that amongst other things include multiple senders) the class spikes the cpu. This is due to the way the native API works and the solution is not to run the thread that is responsible for raising events. To do that, follow the advice of the article and create a new P2PMessageQueueSender class that inherits from the original one and simply overrides the StartEventThread with an empty method (Note that this solution should also work for the 1st issue described above)

3. If you are porting the code to NETCF v2.0 (when I wrote the article it wasn’t released yet), there are things you can do to the code other than simply recompiling it, such as making any worker threads to background (IsBackground=true) .

Of course, the easiest thing for you to do is none of the above. Simply get the SDF from OpenNETCF, which will include the above improvements (plus you can then get support from the team as opposed to the “as is” code of my old msdn article ;-)).

For other NETCF questions, please use the newsgroup and forum...

MVPs, MVPs, MVPs

Fri, September 29, 2006, 03:45 AM under Events
One of the four major drawbacks of accepting my job here at Microsoft was losing my MVP status.

So I am excited to be attending our UK MVP Open Day today and delighted to be involved with this event from the other side. Any new or old MVPs here in Reading (TVP) for the day make sure you say hi! (Come at the “Speaker Coaching” and “Developer Evangelist Roundtable” sessions, not to mention the drinking sessions after...)

For those MVPs that didn’t make it down for the day, if you are on the developer side of things, one of the announcements today was that you can think of me as an additional contact of the local office. My email is on the left :)

CommandLink for XP

Thu, September 28, 2006, 01:57 AM under dotNET
I've talked about the new button style in Vista before: CommandLink (and Vista uses this everywhere).

While looking on the web for something irrelevant, I came accross an old post by Geoff Appleby that offers a custom implementation of CommandLink for XP. Check it out!

Events yesterday and next Tuesday

Wed, September 27, 2006, 07:33 AM under Events
http://msevents.microsoft.com/CUI/EventDetail.aspx?culture=en-GB&eventid=1032308506

Yesterday we run the final rerun of the MSDN roadshow. In the short version of my Vista session I advertised my other upcoming session next Tuesday and someone from the audience pointed out that they could not register because it was full. I checked with the events team and we have now moved it to a larger room so if you tried and failed, please try again to register here (and ignore the "full" message, go on the waitlist and you'll be fine).

Note that I am tweaking (once again) the content I delivered in Edinburgh so it should be even better (as if that is possible :-p)

Support for development IDEs on Vista

Tue, September 26, 2006, 01:36 PM under Windows | Vista
I am never happy when I learn about Microsoft things after they have hit the public (I thought one of the perks of working here is that I get to hear about these things in advance). Anyway, that is probably (if not definitely!) my fault.

* So the good news is that VB6 is basically supported on Vista from both an IDE and a runtime perspective. I didn’t know that probably because I don’t have a personal interest, but no doubt good news for those still in that world.

* We have now opened up a Beta release of SP1 for VS2005 (I knew about this one). This will not address all VS2005 issues on Vista (I didn’t know that, but admittedly, the issues are minor).

* The big news however for many of you and I am sure this will be discussed widely over the next few days: Visual Studio .NET 2002 and VS.NET 2003 will not be supported on Windows Vista.

Feel free to discuss these here.

Vista: Power Aware

Tue, September 26, 2006, 12:00 AM under Windows | Vista
Vista has a great mobility story for both the end user and the developer. By "mobility" here I mean the mobile PC (i.e. laptop/notebook, tabletpc, umpc). If you followed my Vista links, you’ll have come across the top 10 developer calls to action and number 10 on the list is: build for mobility.

One of the features I call out at my developer sessions is being power aware. Nobody likes a mobile PC that overheats and more importantly one that quickly runs out of battery; so you don't want your application to be the culprit that users point the finger at. When the user changes to a "power saver" plan, your app should respect it. When the user has pulled the cable and is running on battery, respect it! “Respect” means acting accordingly and consuming fewer resources avoiding unnecessary cpu intensive activities and thus saving battery life. Doing that, will allow your users to use your app for longer :)

To read more about being power aware, please visit the following 3 links:
- There is an msdn page here.
- There is also a nice article by Neil Roodyn here.
- You can follow links from the msdn page to a great Visual Studio solution that demonstrates what you have to do (direct link to exe here).

Once you download the lab (from my 3rd link above), browse to "\VISTA_POWER_CS\Lab 4 completed" and open "Vista Power Management" project. When you run it, it looks like this. Check it out, it is good :-)

I usually demo a very tiny subset of what is shown there. So if you've been to one of my talks and want my inferior demo, you may download the zip here. Run it on Vista, change your power plan and watch how the application responds. Do the same by pulling your power cable (note: do not pull your power cable if you are on a PC instead of a mobile PC! :-))

Search sample

Sun, September 24, 2006, 07:40 AM under Windows | Vista
To programmatically use search, I've already mentioned that as a managed developer you should be looking at Catherine Heller's blog and nothing has changed. From there you can find a whole bunch of useful info including the relevant links to msdn and the windows sdk. I am not repeating them here 'cause I really want you to visit the source and learn :-)

So the point of this blog post is simply to share with you the sample I use in my sessions when demoing how to search from your applications. Download the zip here.

After you build the VS2005 solution, when you run the app, you'll see the following in the textbox:
SELECT <columns> FROM SYSTEMINDEX..SCOPE() [WHERE <predicates>]

To start with replace it with this (and hit the button to see the results in the datagrid):
SELECT "System.FileName", "System.Size", "System.DateModified", "System.ItemType" FROM SYSTEMINDEX..SCOPE() WHERE "Directory"='file:c:\Windows\System32' ORDER BY "System.ItemType"

As I said, to learn more about the OleDb provider connection string and the query syntax, follow links from my previous Vista Search blog post.

OT: British Military Fitness

Sun, September 24, 2006, 07:26 AM under Random
Off topic post, not even a pinch of technical content

Anyone that knows me can tell you that I am not into fitness/gym or any of that stuff at all (I've been to the gym twice in my entire life). When younger I was good with sports (e.g. football, basketball) and was in the school team and also played with colleagues at previous employment. However, in the last 13 months I have not played any sports (SCUBA doesn't count I guess) and today Jenny finally convinced me to do some exercise and she dragged me away from the laptop.

She signed us up for a trial at this thing here in the UK called British Military Fitness[1] where they tell you what to do, for 1 hour, outdoors in the park. Shocking! I thought I was going to die!! My ears where buzzing and you could fry an egg on my head. I am sure my heart stopped at one point. In fact, I've seen in films where people push themselves so far that they throw up... I never understood that, but today I came close... very close!! Needless to say I am not going back there again!

Having said that, if you think you are fit, give it a shot (they are all over the UK and also partner with a US company). Alternatively, play a prank on someone you don't like and buy them a voucher. If anybody is expecting a Xmas gift from me, now you know what it will be ;-)

[1] BMF

Giant logical leap

Sat, September 23, 2006, 11:40 AM under Random
This is old news (12 days to be precise), but I just came across it. This guy writes a farewell letter to the Microsoft world on his blog. The poor fella describes how he has had the misfortune of working with developers that are not passionate about their job (what I call the 9-to5ers, what he calls DayCoders). He then concludes that it must be all Microsoft developers that do not love their jobs (!) and hence he has now switched to open source, mac etc so he can work with talented developers.

In the dictionary, under "unjustified giant logical leap" there should be a link to his blog post. (or maybe it is a great marketing move on his behalf to attract sympathy from the non-Microsoft friendly crowd... who knows...)

Here are some choice quotes from his post:
"...the word Consultant sounded so wonderfully romantic to me and I wondered if ever I'd make it there as one of the elite band..."

"...I found myself surrounded by power hungry muppets, the odd idiot, a few downright liars (the practice director in particular being one of them), and only a smattering of the elite coders I dreamed I'd find there..."

"...over and over I'd be lambasted for being too passionate (a condition muppets refer to as arrogance)..."
His blog entry attracted almost 300 comments! Read it for yourselves and, as an aside, get someone else's opinion on Avanade (but wear your laughing hat :-D).

Windows Embedded CE 6.0

Fri, September 22, 2006, 01:12 PM under MobileAndEmbedded
I followed the launch link from Mike's blog and, unless I am reading too much into it, the official product name for the next version of Windows CE is... (drum roll)...
Windows Embedded CE 6.0

Glass nugget

Fri, September 22, 2006, 07:55 AM under Windows | Vista
By now you know about the MSDN nuggets, of course.

Well, they finally published the one I did on Vista glass so you can watch/download it following the instructions from the link above.

This is a superset to the one I did for channel9. The additional 7 minutes are there to describe the feature and for a couple of slides (that I stripped out from the channel9 version).

Please note that, since Vista RC1, achieving glass through the TransparencyKey does not work anymore for Windows Forms (so ignore those 3 minutes in the video). The other two approaches are fine though :-)

Finally, for an overview of the DWM APIs see Greg Schechter's post.

Vista SKUs

Fri, September 22, 2006, 02:26 AM under Windows | Vista
Someone asked me about the different Windows Vista editions and what will be included in each one and I promised an answer on this blog...

If you download the product guide (item 1 link from here) you'll find section 2 dedicated to this topic (start at page 7).

First it describes the 6 SKUs as follows:
For Consumers: Home Basic, Home Premium, Ultimate
For Business: Business, Enterprise
For Consumer in Emerging Markets: Starter

You can then find a table on page 13 that summarizes the SKUs by customer segment, a table on page 14 that summarizes the SKUs by sales channel and a table on page 15 that compares the Windows XP SKUs with the Windows Vista SKUs.

Best of all, from page 16 to 20, there is a matrix of features against editions! (there may be an inaccuracy or two in there but overall it should give you a good head start before RTM).

Also of use may be these pages help and getready.

XPe SP2 FP07 CTP WTF

Thu, September 21, 2006, 01:56 PM under MobileAndEmbedded
At most of my sessions on Vista I make the assertion that everyone has switched to .NET 2.0 and usually I get everybody nodding, but last week someone said:
"No, because it is not supported on Windows XP embedded".

I didn't know that at the time, but looking at the fountain of all knowledge (aka MSDN) I found this download that contradicts that statement: .NET 2.0 for XPe

While following links from the XPe site I also found a chat from a month ago about the longest product name ever:
"Windows XP Embedded Service Pack 2 Feature Pack 2007 Community Technology Preview"

What makes it even funnier is that besides the "2007" in its title, it is actually scheduled for release this year :-))

Bad luck, events and a letter

Thu, September 21, 2006, 06:34 AM under Events
If you read this, that and the other, you'll know that I’ve been a headless chicken over the last 8 days. What you may not know is that I also suffered a hardware problem with my laptop, that my car got clamped at the worst possible moment (but that is a story for another day) and that I had an inexplicable electrical power failure in my flat!

I was hoping to rest a bit today but then I realised that I have to upload my slides for my Tech Ed sessions by tomorrow (sorry, that will never happen) and set a machine up for the Roadshow next Tuesday (yes we are doing it at TVP again, register now).

Anyway, in case you haven't come across this yet, I thought I'd pass on a link to jim's letter to Vista developers.

Sharing assets between Windows Mobile and Windows Desktop

Thu, September 14, 2006, 11:10 AM under MobileAndEmbedded
If you missed my session at MEDC, I'll be doing a repeat online for the Windows Virtual Mobile Group next Wednesday 20th September (12:00AM Eastern Time, 17:00 GMT)

Register Now!

I’ll be assuming knowledge of device development of course so if you are a desktop developer, get started ;-)

Windows Vista goes to Edinburgh

Tue, September 12, 2006, 03:40 AM under Events
http://msevents.microsoft.com/CUI/EventDetail.aspx?culture=en-GB&eventid=1032306822

Wow, 150 minutes of Vista for developers and without talking about NetFx3 or C++ at all! How am I supposed to fill that time with quality content? Come find out what others are not telling you in Edinburgh on Wednesday 20th September (repeated in Reading on 3rd October). Register now!

A few of us are having drinks/food the night before; if you fancy that too, drop me a line.

DDD4 call for speakers

Sat, September 9, 2006, 10:01 AM under Events
For me, one of the four drawbacks of working for Microsoft (I’ll write about the other 3 some other time) is that I cannot submit a session for the Developer Day here in the UK. Hopefully you can though so go submit a proposal there now!

I’d like to see a session linking UML activity & state diagrams with WF – I don’t think anyone has picked up on their similarity yet.

WMDC for Vista RC1

Thu, September 7, 2006, 02:40 PM under MobileAndEmbedded
No, it is not out for public consumption yet (although it is running here on my laptop). I was going to write an explanation to address the WMDC confusion... but Mel beat me to it here.

Windows Vista in Swindon

Wed, September 6, 2006, 01:57 PM under Events
Windows Vista goes to Swindon next Wednesday so, if you are in the vicinity, make sure you sing up here!

Title: Windows Vista - Beyond NetFx3 with Daniel Moth
Date: Wednesday 13 September 2006
Overview: This session will start with a quick tour of the new operating system, describe the new APIs available and demo how to take advantage of some of them in Visual Studio 2005 (including the aero guidelines, glass, taskdialog, UAC, RSS, and sidebar gadgets).
Venue: Nationwide Building Society, Nationwide House, Pipers Way, Swindon, SN38 1NW
Times: 18:30 - 21:00(19:00 start)
Registration Details: emma@vbug.com OR call 01753 649687

This is a longer session than what I do for the roadshow (and I am preparing for it right now). It will be slightly different than the one I did in Newcastle (for one, we will be running Vista RC1).

The following day, on the Thursday, I have a press event on Windows Vista and NetFx3 in London and then on the Friday I'll visit my former colleagues at Trend in Horsham to give an overview of what's coming on the Microsoft platform. While you cannot subscribe for these two latter events, I still have to prep for them which might help explain any potential slowdown in my communications… :-)

Vista: WFP and WER

Tue, September 5, 2006, 02:49 PM under Windows | Vista
Three weeks ago I wrote a short overview article of Windows Feedback Platform (WFP), the evolution of Windows Error Reporting (WER). Those of you who are subscribed to the msdn flash newsletter will have (hopefully) read it already (published 17th August). Its title: "Code quality, customer feedback and application reliability with Windows Vista".

If you want to read an online version of it (or wish to subscribe to the essential msdn flash) please go here where we store the archives.

In the article, I mention the Application Recovery APIs that I covered on my blog: RegisterApplicationRestart and RegisterApplicationRecoveryCallback.

If you've read those posts, you may wish to demo the APIs without having to explain WER and the dialogs that get thrown (I was in such a situation recently). One thing we can do is turn off WER for your sample demo application. To do that we need to wrap WerAddExcludedApplication like this:
[DllImport("wer.dll")]
internal static extern uint WerAddExcludedApplication(string pwzExeName, bool bAllUsers);


...and then call it like this:
WerAddExcludedApplication(AppDomain.CurrentDomain.FriendlyName, false);

Of course, if you do leave WER enabled, remember to show that with Windows Vista it now works even for hangs (not just for crashes) :-)

Vista UAC Security Policies

Mon, September 4, 2006, 05:20 PM under Windows | Vista | UAC
In the office today I was reading a popular PC magasine here in the UK and in the contents it said Dave (sorry I forget surname) looks at User Account Control in Windows Vista. I went to the page and read the article that left me quite disappointed. First, it doesn't really explain the goals behind UAC and how UAC achieves that: this information is available online (two clicks from my blog entry on User Account Control). Second, over half of the article is basically what seems to me a rant on the 'virtualization' feature (again, I cover virtualization on my UAC post). While I advise devs not to take advantage of virtualisation, I understand its purpose in offering crutches to some legacy applications that would otherwise break. In any case, the most disappointing thing about the article was that it didn't even mention how to turn off virtualization. While I did this at the nugget I link to from here, let's repeat it in written form.

1. In your Windows start menu go to the search box and type "sec" to bring up the "Local Security Policy"
2. Navigate to 'Security Settings->Local Policies->Security Options' and scroll to the bottom.
3. There you'll find 9 policies pertaining to User Account Control. Double click on the last one ("Virtualize file and registry write failures to per-user locations")
4. Change the value from Enabled to Disabled

With Vista RC1 there is an improvement to the dialogs that come up for each policy. There is an additional tab: "Explain". Click on this one to read about what the policy does :-) For the policy we've been talking about it looks like this:



I leave it to you to read the explanations for the other 8 policies:
- Switch to the secure desktop when prompting for elevation
- Run all users, including administrators, as standard users
- Only elevate UIAccess applications that are installed in secure locations
- Only elevate executables that are signed and validated
- Detect application installations and prompt for elevation
- Behavior of the elevation prompt for standard users
- Behavior of the elevation prompt for administrators in Admin Approval Mode
- Admin Approval Mode for the Built-in Administrator account

BTW, with RC1 (build 5600), the number of UAC prompts you get is significantly smaller than earlier builds so go check it out!