April 2002 Blog Posts
I finished reading the rejected example from the Refactoring book yesterday. Great stuff. In fact, so good that if this didn't even make it into the book then it's now definitely on my Amazon wishlist.

I found this thread on Google that indicates a bug in the released build of MFC70.DLL. It turns out that the DLL doesn't delay load OLEACC.DLL (Active Accessibility) and so loads it even if you're not using any accessibility features. This causes problems on Win95 (where it isn't normally present) and on systems where it wasn't chosen to be installed. Worse, if someone choses to uninstall Active Accessibility, all the MFC7 apps will stop working.

This post in the thread describes how to make a dummy OLEACC DLL that you can drop into your app folder.

One thing that I hadn't noticed before is that Microsoft are recommending that you put MFC70.DLL and MSVCR70.DLL in your application folder since they are no longer classed as system files and shouldn't really be in SYSTEM32. Visual Studio.NET puts them there for convenience so that you don't have to keep copying them for each build type of each project you develop.

I realised that nearly every weblog post I start to write begins "I just got around to..." although I manage to edit it out of the final text sometimes. In any event, I "just got around to" sorting out my Amazon wish-list (one can but hope... ;^>).
Thought it was about time I took a closer look at the printing support in the .NET framework and one of my friends had been asking about an applet for printing a bitmap from the clipboard (after pressing 'Print Screen') without having to paste it somewhere first. Here's the result - a tiny C# applet.

I've finally got around to making the source code available for my Internet Explorer print add-in. The zip file contains a (VS.NET) attributed ATL component project and an Internet Explorer print template that performs the scaling.

If anyone spots the reasons for the outstanding issues, I'd be grateful if you could let me know.

I've uploaded a revised version of my Internet Explorer add-in for "width-fitted" printing (must come up with a better term than that). You can get it from the same download page as before.

This version includes a better print preview interface and fixes a few rounding errors when scaling the page. Unfortunately, I've not yet managed to fix a problem reported by Tim Tabor (thanks) that appears to be related to fixed-width characters and results in slight clipping on the right hand edge still. I can work around it by making the browser window a little bigger, but it is annoying.

There was also a problem reported where IE reported that a script was taking too long to run but I haven't been able to reproduce the error.

Finally, I have a couple more changes to make and then I'll make the source code available.

This is my first hit at an Internet Explorer add-in to support "width-fitted" printing. Have you ever printed a web page only to find that the right-hand edge is missing? This is for you. First, this download page will install the control. After installation, close the browser window and reopen a new one. You should have a new printer icon with a small 'W' next to it on the toolbar. Press this to bring up a print dialog which will then print the page fitted to the width of your paper. Alternatively, hold down the Control key while pressing the button and you will get a print preview instead.

To remove the control, go to Tools, Internet Options, General, Temporary Internet Files Settings, View Objects. In the window that pops up, find the IEPrint control, right-click and choose Remove.

I've tried this on IE6 with WinXP and Win2K. It ought to work on IE5.5 too.

Lots of C# links here.

Finally got the code I've been working on for the last few weeks all hooked up together so that I have some ASP.NET pages calling into my class libraries, which are written in a mixture of C#, VB.NET, and managed C++. This works great, and the code separation compared to straight ASP makes maintenance much easier.

One thing I did find out, that didn't appear to be documented on MSDN, was that when you call the Image.Save method, some ImageFormat's need the output stream to be able to seek and others don't. For example, the ImageFormat.JPEG version seemed quite happy to write directly to the ASP.NET Response.OutputStream. For PNG, however, I had to write to a MemoryStream and then copy the contents to the Response.OutputStream afterwards. The error message wasn't particularly helpful, giving an interop exception with GDI+. Oh well, problem solved now.

Just a quick code snippet for an Autorun applet that calls ShellExecute on the command line argument.

Genie allow you to send up to 600 free SMS text messages each month using a free account from their web site. I've written a quick C# class that allows you to use this facility from your code.

If you're interested in writing apps that use the MSN Messenger protocol, Chris Sells has written some simple C# code to send messages.

Also, take a look at MSN Messenger Protocol(Practical Implementation) a.k.a How to make your own MSN Messenger In VB.

I've started my own asynchronous event-driven code library in C# which is progressing well, but not quite ready for publishing yet. Check again soon...

Creating a Multi-User TCP Chat Application shows how to write asynchronous TCP socket applications using .NET.

The .NET support for socket-based programming within Visual Basic is dramatically improved over what we had in Visual Basic 6. So even though we approach the programming issue somewhat differently, it is worth it due to all the new capabilities at our disposal. [MSDN]
HTTP Made Really Easy is a great article that describes the basic HTTP protocol should you wish to implement your own client/server.