# Thursday, 29 April 2010

Would you like to learn more about developing for Windows 7 in C# or VB? My Pluralsight On-Demand! tutorial has just gone live. 9 of the 11 modules are there now and the last two will be shortly.

As the abstract says:

This tutorial is aimed at Windows developers (Windows Forms or WPF) who want to add Windows 7 capabilities to their application. The emphasis is on providing a helpful and efficient user experience by hooking into what Windows 7 has to offer. You do not need to know how to interop to native code or how the Windows 7 features work internally.

The table of contents looks like this:

  • Light Up on Windows 7
  • Windows 7 Jumplists
  • Taskbar Overlays on Windows 7
  • Taskbar Thumbnails on Windows 7
  • Network Awareness on Windows 7
  • Power Awareness on Windows 7
  • Windows 7 Libraries
  • Windows 7 UAC and Manifests
  • Partitioning Administrative Tasks for Windows 7
  • Known Folders for Windows 7 (under development)
  • Scheduled Tasks on Windows 7 (under development)

The course has been a lot of fun to put together. I used the Code Pack to keep the amount of code you write to a minimum. Some of the demos use samples that come with the Code Pack; others use my own code, and you can spot those by the Demos download link.

The content is all subscribers-only, but you can get a Guest Pass to check it out. Also, RDs and MVPs get a free subscription, so if you qualify, this would be a great time to use that. Let me know if there are more topics you'd like to see me cover (after I get this one finished, of course!)

Kate

Thursday, 29 April 2010 08:26:26 (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, 27 April 2010

MFC had some Windows 7 support starting with the release in between Visual Studio 2008 and Visual Studio 2010. There was a ribbon, for example, though there was no designer. In Visual Studio 2010 there is a ribbon designer, very nice, and tons of UI fun as well. In this post I'd like to focus on some MFC support for taskbar interactions. Any idea what these two lines of code do?

HICON i = LoadIcon(NULL,IDI_WARNING);
SetTaskbarOverlayIcon(i,L"Warning");

Here's the visual evidence:

Yep, you load an icon and then you set it as an overlay icon on your taskbar. Nice and simple.

How about this:

m_jumplist.InitializeList();
m_jumplist.AddTask(L"http://images.bing.com",L"",L"Bing",L"",0);
m_jumplist.CommitList();

You need to know that m_jumplist is a member variable of type CJumpList - a new type in MFC. Here's what that code causes:

This is remarkably little code to be all up to date and modern, isn't it?

If you want more info on C++ and Visual Studio 2010, here's a nice article by Sumit Kumar and a Channel 9 talk with Pat Brenner. Enjoy!

Kate

Tuesday, 27 April 2010 11:28:09 (Eastern Daylight Time, UTC-04:00)  #    
# Sunday, 25 April 2010

Once again Carl and Richard are driving across the country to celebrate a Microsoft launch. This time it's for Visual Studio 2010.

As they say on the roadtrip page:

Carl and Richard are loading up the DotNetMobile (a 30 foot RV) and driving to your town again to show off their favorite bits of Visual Studio 2010 and .NET 4.0! Richard talks about Web load testing and Carl talks about Silverlight 4.0 and multimedia.

And to make the night even more fun, we’re going to bring a mystery rock star from the Visual Studio world to the event and interview them for a special .NET Rocks Road Trip show series.

Along the way we’ll be giving away some great prizes, showing off some awesome technology and having a ton of laughs.

So come out to the most fun you can have in a geeky evening – and learn a few things along the way about web load testing and Silverlight 4!

You can track their progress online, too! Looks like a blast.

Kate

Sunday, 25 April 2010 10:12:14 (Eastern Daylight Time, UTC-04:00)  #    
# Friday, 23 April 2010

I like to introduce myself, in C++ circles, by mentioning I was using C++ before Microsoft had a C++ compiler. It's often interesting to watch people try to handle the concepts behind the sentence - mostly, that for some languages you can buy compilers from more than one vendor. And once upon a time, C++ existed as a language, and Microsoft sold compilers, but it didn't have a C++ one yet. Then eventually (OK, in 1992) the C product Microsoft sold became a C/C++ product (compiler, linker, debugger etc) and then the next year Visual Studio came along and with it Visual C++. And Visual C++ 1 included the Microsoft Foundation Classes 2, so that for a while the version numbers of Visual C++ and MFC were out of sync. Eventually there was a version skip to catch up (there was no Visual Studio 3). For quite a while we all worked with Visual C++ 1.52c and every speck of that version number was significant. So as you can see, the version of a product is not a simple question with one answer.

So, here we are, welcoming Visual Studio 2010. Lots of people called it Dev10 while it was under construction. But was the 10 short for 2010? It was not. It was just 10, as in the number after 9. Visual Studio 2008 was 9, and Visual Studio 2005 was 8. You can see these numbers on the shortcuts to your sln files, by the way:

OK,so VC8 means Visual C++ 2005? Basically. As long as you realize that it doesn't mean version 8 of the compiler. Because the C compiler transitioned into the C/C++ compiler, the version numbers came with it. VC8 includes version 14 of the compiler. Confused yet? If so, you're in good company. Here's a tabular explanation, though it only goes back a decade. You want more details? Wikipedia has them, of course. Me, I am going to enjoy Dev10 and watch for news of Dev11.

Kate

Friday, 23 April 2010 09:08:34 (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, 21 April 2010

One of my pet peeves is software that thinks it's smarter than me. There are times when software does things I wouldn't think of, without asking me, and I find that helpful and I like it. But it can backfire. The worst offender was FrontPage, thankfully now gone. But Outlook has an annoying little habit. It assumes that people who send emails can't really be trusted to format them, so it "fixes" their error for you. In other words, if I send you this plain text email:

Hi,
How are you doing?
Call me when you can.
Kate

Outlook helpfully displays:

Hi, How are you doing? Call me when you can. Kate

Most of the time that's only a petty annoyance. But what about when my code sends:

Monday 1:00
Tuesday 2:30
Wednesday 4:00
Thursday 9:30
Friday 10:00

And you see:

Monday 1:00 Tuesday 2:30 Wednesday 4:00 Thursday 9:30 Friday 10:00

Know what happens then? I do! The user reports a bug that the emails are misformatted. And what's more, when you tell them it's an Outlook issue and send them a screen shot of what to click in Outlook to fix it, they don't thank you. Well, Scott Mitchell has discovered what to do in your code to make Outlook leave your ratsen-fratsen line breaks alone. Just add a space before each newline. Awesome, thanks Scott!

Kate

Wednesday, 21 April 2010 08:49:00 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 19 April 2010

I am accumulating Visual Studio 2010 links at quite a pace. Let's have a bunch in this post:

Kate

Monday, 19 April 2010 14:33:47 (Eastern Daylight Time, UTC-04:00)  #    
# Saturday, 17 April 2010

When I show off Windows 7 features and talk about how you can add them to your apps, I usually show a "sad trombone" moment featuring Visual Studio 2008, like this:

(I really like jumplists in the start menu, so I thought I would show that in my screenshot instead of the classic right-click-on-the-taskbar jumplist. They're the same.) But this jumplist isn't useful. It isn't all the .sln files I've opened before, or the projects, or anything really except some random bits of XML, icons, schemas, and code files that I dragged in to Visual Studio over the past few months while I had some real solution open.

Now this isn't poor Visual Studio's fault. It was released before Windows 7, before anyone knew that the MRU list kept by the OS itself would be important. As I've explained in presentations before, there's a reason this happens. You see, when you double-click a .docx file, Windows looks up who handles those, launches Word to open the file, and accumulates that file name on the MRU list for Word. Cool. Ditto for .txt and Notepad, etc. But Visual Studio is different, and it's different so that you can have Visual Studio 2005 and 2008 side by side on your machine, and use .sln for the solution file names in both products. You double-click a .sln file and what actually runs is a little launcher that looks inside the .sln file to see if it's a 2005 or 2008 solution and then runs the right Visual Studio and passes the solution to it. Cool. But as a result Windows isn't accumulating what you opened with Visual Studio 2008, it's accumulating what you opened with the little launcher. The jumplist for Visual Studio 2008 therefore contains only things you opened directly with it, and that's not a very useful list.

OK, so I know why. And it's nice to know, btw, that Visual Studio 2010 gets it right. And in my presentations, I usually leave it at that, encouraging you to add the one whole line of code to your app (if you're using Code Pack) so you "don't be that guy".

But wait! What if you want a good jumplist for Visual Studio 2008? Especially if you don't have Visual Studio 2005 installed any more, so you don't care about the whole pick-what-version-to-launch feature? Well, you could try this suggestion from Josh Einstein. I like that he doesn't explain it much and says "If you need more instructions then the hack probably isn’t for you." His instructions, terse as they are, are for 64 bit Windows 7. A commenter supplies the 32 bit version.

I actually haven't tried this yet. Don't want to set my computer on fire or anything :-). But if you feel like living on the edge, give it a whirl!

Kate

Saturday, 17 April 2010 08:22:25 (Eastern Daylight Time, UTC-04:00)  #    
# Thursday, 15 April 2010

I've been making videos lately, as I've mentioned. So among other things I've needed to know the total length of a bunch of .wmv files. Now sure, if you have a spreadsheet you can teach it to add up times. But the ironic thing is, I was asking the file system for the length (in minutes) of each video, then adding them up, when I could have just asked the file system for the total length!

Well that's fun! Notice it also adds up the total file size. I find these little savings really add up to keeping me focused on what I'm really trying to achieve (write a tutorial) instead of getting caught up in minutiae.

Kate

Thursday, 15 April 2010 11:51:57 (Eastern Daylight Time, UTC-04:00)  #