# Friday, 07 May 2010

Jani Jarvinen (a Finnish C# MVP) wrote a nice article about using sensors with Windows 7. He mixes and matches .NET 4.0 and Code Pack capabilities, and has links to plenty more information. I like the screenshots and the step by step approach. Windows 7 really does make this so much easier than it used to be. He gets you started with both an ambient light detector and some simple location code.

A little more exotic approach comes from "gleat" who has a Code Project article using a Wiimote as the accelerometer. He starts out simple - here's how to download and install the driver - and then goes into writing a client in C#, leveraging Code Pack of course. But then he says hey, were you wondering how to write a driver? and wham! you're hip deep in C++. It's all well explained, though, so if you want to learn more about this, what a terrific way to start.

If all of this is making you wish you had Windows 7 somewhere to play with, but you don't want to buy it, don't have an MSDN subscription, don't qualify for BizSpark etc, then what you need is a free 90 day evaluation of Windows 7, right? I found that link on this handy Doug Turnure blog post from earlier this year that includes some video links I hadn't seen before. Have fun!

Kate

Friday, 07 May 2010 12:14:02 (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, 05 May 2010

I was just looking up the session codes for my Tech Ed talks next month (my flight to New Orleans leaves a month today, at about this time actually) and spotted something unexpected:

DEV316 | Modern Programming with C++0x in Microsoft Visual C++ 2010
Session Type: Breakout Session

Track: Developer Tools, Languages & Frameworks
Speaker(s): Kate Gregory
Level: 300 - Advanced
Why wait for the C++ committee to finish the specification when you can enjoy much of the power of C++0x today! C++0x, the next C++ standard, is almost upon us and it contains the most important updates to the language since the mid-90s. It even accepts the existence of multiple threads for the first time in the history of the language. Needless to say, these new features bring more expressiveness and power to the native C++ developer. Visual Studio 2010 has added support for some of these key features in order to enable these modern programming techniques. This session clarifies what features are in Visual C++ 2010 and what is yet to come. It illustrates how new constructs such as lambda expressions enable better use of existing libraries and how your code can be simpler, safer, and faster all at the same time. If you are itching to show off how C++ is one of the coolest languages on the planet, this talk is for you!

WCL316 | The Windows API Code Pack: Add Windows 7 Features to Your Application
Session Type: Breakout Session
Track: Windows Client
Speaker(s): Kate Gregory
Level: 300 - Advanced
Accessing new Windows 7 features is a challenge from managed (.NET) code. The level of interoperability required is out of reach for many developers. The Windows API Code Pack for the Microsoft .NET Framework is a sample library you can use in your own projects today that provides access to new user interface features (taskbar jumplists, libraries, sensor platform, and more) as well as "behind the scenes" features that make your applications more aware and responsive (restart and recovery, power management, and more.) Discover a shortcut to Windows 7 development for Microsoft Visual Basic and Visual C# programmers and get started today.

The first digit carries meaning, but the last two don't. So I don't really know how they both got to be 316. Since I often have trouble remembering my session codes, this should halve the effort for me :-).

Kate

PS: I checked whether the Brian rule still applies. You can too, by just dropping down the "Speaker" box on the session catalog page. I'm happy to report there are 9 Brians and I reached 9 obviously female names (ignoring Alex, Chris etc) while I was still in the C's. Good news, in my opinion!

Wednesday, 05 May 2010 13:54:51 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 03 May 2010

The Windows API Code Pack is one of my favourite libraries. For Windows 7 features that are not yet in the .NET Framework, it simplifies access from managed code, saving you from learning how to do interop. And it comes with a nice suite of samples that help you to understand how the feature works and how to use it. I've been incorporating Code Pack into a lot of the modules in my Pluralsight Windows 7 tutorial, and using the samples for demos when they're appropriate. In just a little over 5 months, almost 70,000 copies have been downloaded directly:

The thing is, Code Pack is not a product. You can't call for support on it (though there are discussion and issues section on the Code Gallery page, and people really do read them.) There's no guarantee that there will be more versions in the future. But there are plans for at least one more version, and Yochay is looking for your thoughts on it.

If you ever wanted to add a feature to the Code Pack, were looking for some specific Win32 API to be wrapped, or just wanted to pass us some feedback, this is your opportunity. Please send us your feedback or file a bug using the Discussions or Issue Tracker for the Windows API Code Pack.

He also mentions that about the same number of folks have downloaded other vehicles (eg the Windows 7 Training Kit) that deliver a copy of Code Pack. Those are some nice numbers! Anyway, if you haven't tried it yet, please do, and if you have and there's something you want, please chime in!

Kate


Monday, 03 May 2010 14:46:48 (Eastern Daylight Time, UTC-04:00)  #    
# Saturday, 01 May 2010

On Thursday night I was the surprise mystery guest for the St Louis installment of the .NET Rocks Roadtrip. What a fun little jaunt that was! We recorded an episode of .NET Rocks, (talking about Windows 7, C++, and educating developers) then Carl and Richard both did very interesting presentations. I had seen parts of Richard's before, but Carl's was all new to me and I will just say if you live in the half of the roadtrip that hasn't happened yet, you really need to make an effort to be there and be part of it!

Here's a blog entry by Nicholas Cloud, and another by Brian Williams, and a picture by fallenprogrammer of us getting set up.

The next morning featured breakfast at Cracker Barrel (an experience) and then a ride to the airport in the RV for me and Kindler Chase, who had joined them in Tulsa, before they headed Chicago-wards. It sure was fun to be part of it!

Kate

Saturday, 01 May 2010 20:22:11 (Eastern Daylight Time, UTC-04:00)  #    
# 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)  #