May 2009 - Posts

WTL 8.1 is coming!

After almost two years of silence there appears to be activity around WTL again. Of course this makes sense since Windows 7 is almost done. I just noticed build 8.1.9127 posted over on SourceForge.NET.

For starters it now builds cleanly by internally suppressing warnings against the use of unsafe CRT functions. I have got into the habit of including WTL 8.0 in my precompiled header as follows:

#pragma warning(push)
#pragma warning(disable:4996) // WTL still uses some unsafe CRT functions
#include <atlapp.h>
.
.
.
#pragma warning(pop)

Well no more. To be precise, it still uses those unsafe functions but the warnings are now suppressed internally and explicitly around those functions so that we don’t have to deal with it ourselves.

Wrappers have also been added for the Desktop Window Manager API as well as the support needed to subclass and double-buffer the painting of controls on glass. For more information on the DWM API as well as the issues with controls on glass you can read my articles here and here.

Beyond that it looks like this is just the initial placeholder for what will become the 8.1 release of WTL.

Posted by KennyKerr with no comments
Filed under:

Visual Studio 2010 and .NET Framework 4 Beta 1 are here!

Microsoft has finally released an update to the Visual Studio 2010 preview build that showed so much promise but unfortunately was so unreliable. If you have an MSDN subscription just head over to subscriber downloads and start downloading now!

Interestingly (and thankfully) they appear to have reduced the number of SKUs. There is only “Professional” and “Team Suite”.

Posted by KennyKerr with no comments

Resolving Windows Sleep Problems

This is more of a reminder to myself but it may come in handy for you.

Whenever I reinstall Windows I always make sure to install the latest chipset drivers from Intel which tends to make things run more smoothly, especially on laptops, with regards to power management.

On my desktop computer there is one more step I need to take before it will correctly sleep and stay asleep but I always seem to forget this and spend some time wondering which driver or device isn’t letting the computer go to sleep. Nine times out of ten though it’s not as a result faulty or missing drivers but is actually “by design”.

Wired network adapters seem to always be configured to Wake-on-LAN by default. This may be useful for corporate networks but is terribly annoying for home computers where it gives the appearance that Windows simply can’t sleep reliably when in fact it is the network adapter that keeps waking up the computer when network traffic is received.

Anyway the solution is simple, simply uncheck the “Allow this device to wake the computer” option for you wired network adapter:

 

Hope that helps.

Posted by KennyKerr with 5 comment(s)

C++ Exception Handling

A while ago I made a passing remark on my blog that I prefer not to use exceptions in native code. Some readers asked me to justify this position and I’ve been a bit reluctant to do so only because it’s a lengthy argument that I’m sure will bring a lot of passionate responses that I don’t really have the time to deal with. I was reminded of this again last night when I walked past one of our bookshelves at home and picked up my copy of John Robbins’ excellent debugging book and noticed that it has a chapter on crash handlers within which John does a good job of covering many of the reasons why I don’t use exception handling in native code. If you’re interested in this topic I would encourage you to read John’s book.

Of course I still write “exception safe” code in the sense that I use “resource acquisition is initialization” or constructors and destructors to scope resources, avoid side effects in functions, define invariants, etc. but this is just good practice to write simple and correct code whether or not exceptions are in play.

The Visual C++ compiler actually lets you disable exception handling in your code which by the way improves performance and reduces code size. Here’s how:

 

The story is very different for managed code where exceptions are very much an integral part of the runtime and thus cannot be avoided. Of course managed exceptions more than make up for the pitfalls with exception handling by providing a standard base class with exception information including the call stack at the time an exception was thrown thus greatly improving the ability for developers to track down bugs.

 

Posted by KennyKerr with 15 comment(s)

Exciting Changes

I’ve made a few changes to my professional life. I’ve had the opportunity to work with some really talented developers in London and I’m sorry to say goodbye to them. I’ll talk more about that in the coming weeks and months but one of the outcomes is that I’ll have much more time for my software projects. To unwind from employment (e.g. slavery :) ) I took Karin and the kids camping and boy did things change in the world of Microsoft technology in just one week. Here are just some of the announcements.

Windows 7 (and Server) Release Candidate – by far the biggest news is the arrival of the Windows 7 RC. You can get it from your MSDN subscription along with the latest Windows SDK. The server version of Windows 7, called Windows Server 2008 R2, is also available. Interestingly, the Windows SDK is now split across platforms.

Office 2007 Service Pack 2 – the next service pack for Office 2007 is out so if there was ever any doubt that Office 2007 is ready for mass corporate adoption you’re now all out of excuses!  :)

Windows Vista Service Pack 2 – the second service pack for Windows Vista has also been released.

Virtual PC Beta – we all thought it was dead but here comes a new version. It looks like this will be the last version of Virtual PC before Hyper-V is rolled into all versions of Windows. In other words I expect Windows 8 to include Hyper-V just as Windows Server now does. This is in much the same was as Remote Desktop Services first debuted in Windows Server and is now included in all editions of Windows.

If you really need XP support then you may want to take a look at Windows 7’s XP Mode, which allows you to run Windows XP applications on your Windows 7 desktop. This uses the new version of Virtual PC but will eventually be based on Hyper-V.

As a (native) C++ developer there’s just so much to be excited about when you consider Windows 7. I’ve started covering Windows 7 technology in my Windows with C++ column in MSDN Magazine and you can expect many more articles focused on Windows 7 in the coming months. Here are just a few that I’m particularly interested in:

Virtual Disk API – I covered this in the April 2009 issue of MSDN Magazine.

Direct2D – I have an introduction to Direct2D in the upcoming June 2009 issue of MSDN Magazine.

In addition there are new APIs for advanced text rendering and typography, powerful user interface animation, ribbon user interface, web services clients and servers, and much more. And all of this is designed for C++ developers! I’ll be covering many of these in upcoming articles.

As I’ve said before, these are exciting times for a C++ developer on Windows.

 

Posted by KennyKerr with 3 comment(s)
More Posts