Saturday, November 27, 2010
People say you can't get unit test support from Visual Studio for native code. That's not strictly true. Your tests will need to be managed code, but that doesn't mean the code you're testing needs to be.
As I hope you know, it's super easy to call native C++ code from C++/CLI - include the header, link to the lib. So here's the deal. Make yourself a lib that holds all the code you want to test. This can be completely native code, no problem. Build your UI (or your web services layer or your service or server or whatnot, I don't mean by UI an actual interface that a user clicks and types to, I just mean the part of your app that consumes your business logic) in native code if you like. Or in managed code, that's cool too. Then create a C++/CLI test project that includes the header for the logic, and links to the lib. There you go.
For the gory details including precisely what menu items to select and how to set up the project, John Socha-Leialoha
has you covered. I love his conclusion:
After so many years writing in C#, I never thought I would enjoy C++
programming again. I was wrong. Using TDD to write C++ code is almost as nice as
writing C# code, and I’m really enjoying the experience.
Thursday, November 25, 2010
You know I just love jumplists. Probably my favourite app to have a jumplist is Windows Explorer. After all for Word, PowerPoint, Visual Studio and so on, there is a MRU list on the file menu or the like. But getting to folders I've used recently is super important to me.
That's why I kind of freaked out when the jumplist for my Windows Explorer disappeared.
I tried rebooting my laptop (something I do less than once a week.) No help. I caught up on updates. No help. So I started searching. And I found two articles, one about a jumplist that is slow to load itself
, and other other about an "orphaned" item that couldn't be removed from a jumplist
. That one helped me realize the likely cause of my problem - although I hadn't pinned a mapped folder, I had mapped a drive at a client site, and now that drive wasn't accessible any more, which is perhaps why the jumplist wasn't loading.
But anyway, what to do? Based on what I read in those two articles, I navigated to %APPDATA%\Microsoft\Windows\Recent\AutomaticDestinations (that's exactly what I typed into the Run box, it figures out %APPDATA% for you.) There I saw a whole pile of apps with a strange extension, a little reminiscent of the files that hold the details for libraries:
If you open any of these files in Notepad, you'll see that amongst all kinds of unintelligible strings are paths to files you've dealt with recently. What's more, you can kind of guess which app each file is for by looking at those paths - one file will have a bunch of .pptx files mentioned in it, while another will have a bunch of .xlsx files. Now, which one is Windows Explorer?
Well, both articles said the same name: 1b4dd67f29cb1962.automaticDestinations-ms.I had a file called that, and when I browsed in Windows Explorer to another folder, the timestamp on that file changed. It seemed quite sure that it was for Windows Explorer on my machine too. So, I deleted it, as the articles suggested. Now I still had no jumplist, but when I then browsed to another folder, I had a jumplist with one item in it. From then on life was back to normal.
Something to know if you get a stuck jumplist someday.
Tuesday, November 23, 2010
Windows 7 introduced a lot of new ways for an application to give information to users. There's a thumbnail which is usually a miniaturized version of the whole application, and possible overlays of icons onto your taskbar icon (like how Outlook shows you have new messages, or Twitter shows there are new tweets) and progress bars under your taskbar icon. There are also cool ways for the user to give direction to or about the application. For example, you can right-click the taskbar to bring up a jumplist and launch another copy of the application, or another application.
Right from the beginning, some applications pushed that architecture a bit to use the jumplist to communicate with the application itself. (This requires launching some other application that communicates with the first instance.) For example, Outlook has this jumplist:
But this isn't the only way to send a command to an application from the taskbar, and it's not always the right one. Tasks are the right choice if you're willing to take on the extra work to code them up, and furthermore if they make sense even when the app isn't running yet. So in this example, Outlook, if I want to send a new message then I want to send a new message, even if that means needing to launch Outlook to do so. But what about Messenger? Here's how it used to look:
Does that make sense when Messenger isn't even running? To me, it doesn't. Here's how Messenger handles that now. There's a much smaller jumplist:
How do you set your status? With thumbnail toolbar buttons:
Sweet! Much easier to code, easy for the users to understand, and they don't clutter up the place when the app is not running. Nice decision. And keep this in mind for your own Windows 7 applications.
Sunday, November 21, 2010
Opinions seem to vary a little on the birthday of Windows. Charles Petzold says the files are dated November 15th, 1985. Ray Ozzie says it's the 20th. ComputerWorld says the 20th also.
Whatever you think the date should be, you really need to read the article by Charles. He did a keynote "selling" Windows 1.0 (a product almost none of us used) as a solution to the problems of the day:
Will it spoil the gentle humour throughout the piece, written 5 years ago, if I show you the output of his demo? I think not:
And that is Windows, and I don’t know about you, but after this event is over,
I’m going home and writing me some Windows apps.
I'm with you, man.
Friday, November 19, 2010
One of my track chairs at Tech Ed Europe was Christian Binder. Christian always makes sure there is C++ content at Tech Ed Europe and this year he sat down with Ale Contenti to talk about Microsoft's commitment to C++, which is stronger than ever right now. You might be a little surprised to hear C++ called "the innovation language" but c'mon - if a new API is added to Windows, you can just use it right away from C++, but from some other languages you might have to wait for something to be released that will help you, right?
Christian blogged about the interview
in German, but the interview itself
is in English. Worth a listen!
Wednesday, November 17, 2010
I like to say "If you have a Windows application, it should be a Windows 7 application." By that I mean that you should take advantage of some of the features Windows 7 offers to your apps, and you should give the user the experiences they are coming to expect on Windows 7. You should have a sensible and usable jumplist. If you have a progress bar, you should add ONE WHOLE LINE OF CODE to your app so that progress bar is also overlayed on the taskbar. You should toss your intrusive message boxes and toasts and system tray balloons and use taskbar icon overlays on Windows 7, because that's how users expect to be notified about non emergencies. You should take advantage of restart and recovery, and of being notified about events like going on battery or AC power, or coming online or offline, instead of expensively polling for them. I've written a lot of blog posts and given a lot of presentations on how to do some of those things.
Now, someone is offering you a reward for putting those capabilities into your Windows applications. You can be featured on CNET Downloads if you just submit an application that uses at least one of the 13 features they identify
. If your app is ready to go, submit it today
! If not, why not?
Monday, November 15, 2010
Wondering what's next in Silverlight? Want to become a Silverlight developer? Want to become a better Silverlight developer? Then you should watch the Silverlight Firestarter on Dec 2nd.
Now there are three ways you can watch this event:
- In person, in Redmond. Register.
- Online, wherever you like. Register.
- Online, with the company of fellow programmers to discuss what you're seeing. I think this is better than online by yourself, so I'm excited that the East of Toronto .NET Users Group is hosting a local Firestarter. Register.
What are they covering? Just about everything:
- The future of Silverlight
- Data Binding Strategies with Silverlight and WP7
- Building Compelling Apps with WCF using REST and LINQ
- Building Feature Rich Business Apps Today with RIA Services
- MVVM: Why and How? Tips and Patterns using MVVM and Service Patterns with Silverlight and WP7
- Tips and Tricks for a Great Installation Experience
- Tune Your Application: Profiling and Performance Tips
- Performance Tips for Silverlight Windows Phone 7
It's running 11:30am - 7:30 pm in Ajax on Thursday Dec 2nd, so you'll need to arrange time off work. Considering all you'll learn about Silverlight, it's well worth the time. Be there!
Saturday, November 13, 2010
Wow, these things get up there fast! My sessions were very well received and I had such a great time doing them! In the order I delivered them, they are:
- Women In Technology Panel - Claudia Woods, Freena Eijffinger, Paula Januszkiewicz, and Rhonda
Layfield joined me to take questions from the audience and talk about what was on everyone's mind. There's really no video - just the title slide for the whole hour. Please listen!
- The Windows API Code Pack: Add Windows 7 Features to Your
Application - This one includes screen capture so you can follow along in the demos. You can also download the powerpoints from this page, and as I mention in the talk, the demo code is the samples that come with the Code Pack.
- Modern Programming with C++0x in Microsoft Visual C++
2010 - I had a great time delivering this talk even though it was the first time I delivered this version of it. The attendees responded by putting the talk in the top ten for the whole conference - thankyou! It, too captures the screen and slides, and you can download the powerpoints.
- Advanced Programming Patterns for Windows 7 - Another talk I was doing for the first time and I enjoyed it too. If you'd like the sample code, stay tuned - I will blog when the recipes are released. The slides are with the video of the screen and slides.
If you came in person, thank you! If you couldn't be there, please watch the videos and leave me a comment. Speaking on technical topics really is the most fun you can have standing up, and I can't do it without audiences.
© Copyright 2021 Kate Gregory
Theme design by Bryan Bell
newtelligence dasBlog 2.3.9074.18820
| Page rendered at Friday, December 03, 2021 8:36:35 PM (Eastern Standard Time, UTC-05:00)
On this page....
Pluralsight Free Trial