Recent MSDN Magazine articles

As long as I'm at it, links to recent articles I've written for MSDN Magazine:

Advanced Basics: Set Word Document Properties Programmatically

At the beginning of another lovely day of writing courseware in mad pursuit of unrealistic deadlines, I received a frantic call from a business partner. He was at the end of a long consulting project and had several hundred Microsoft® Word documents, all of which required their document properties to be set identically, except the Title property of the document, which was to be based on the document file name, minus the .doc extension. He didn't have time to set all the properties manually. Could I write a little utility to do the work for him? (Read the rest...)

Advanced Basics: What's My IP Address?

If you're like me, you regularly do tech-support for family, friends, and neighbors. You can't go to a party without hearing the familiar refrain: "I've just got a quick question." It's always something—their Internet connections get dropped, they've got a virus, they can't install some piece of hardware, or some file has gone missing.

Maybe you support your brother or your grandmother. In my case, I spend a good deal of time helping out my father, who is astoundingly agile with his computer considering he didn't pick it up until he was 65. When he has trouble, it would be convenient if I could use Remote Desktop Connection to connect into his computer and see what's going on. Of course, connecting to his computer would require that I know his IP address. That would be simple if he wasn't using Network Address Translation (NAT) behind a firewall, and if he didn't get a dynamic IP address from his ISP. I could have him run a command prompt, get his IP address, and read it to me, but that address would be a useless internal address. I could have him browse to one of the many sites that reports the external (outward-facing) IP address, such as www.WhatIsMyIP.com, and have him read me the address. But attempts to perform this exercise have been frustrating, resulting in misplaced digits, missing dots, and incorrect addresses.

It would be best if he could click a button and have his IP address e-mailed to me. That's the goal of this column. (Of course, one could also use Remote Assistance to make the process easier, but that wouldn't make for a very interesting column, now would it)? Follow along as I create a Windows®-based application that retrieves the IP address of a remote machine and e-mails it to the appropriate mailbox. Along the way, you'll learn a few handy bits of information about ASP.NET Server variables. If you're already using ASP.NET, you should be comfortable with this information, but I'll bet anyone moving from Visual Basic® 6.0 to Visual Basic .NET isn't familiar with the information that's available to a Web site. (Read the rest...)

Advanced Basics: Revisiting Operator Overloading

On the conference circuit recently, I was speaking about some of my favorite new features in the Microsoft® .NET Framework 2.0, using the content of three recent columns in this series as fodder. In my talk I sped through generics, operator overloading, and the BackgroundWorker component, all in the space of an hour (for the columns, see Advanced Basics: Being Generic Ain't So Bad, Advanced Basics: Calling All Operators, and Advanced Basics: Doing Async the Easy Way). This accomplishment requires speed talking, but over the years I've mastered that skill. Of course, a downloadable"fast conference speaker" codec would help listeners keep up, but alas, that may never happen.

After the session was over, one attendee came up to chat. He suggested that my example for operator overloading was a bit too academic. It showed how to create a class named Vector, which contained a one-dimensional array of integers. In that example, you can overload the +, =, <>, and CType operators in order to manipulate the contents of the vector instances. He then suggested an example that is also a bit esoteric, but it presented a perfect opportunity to revisit operator overloading: using the RGBA and HSV standards for handling colors. (Read the rest...)

Advanced Basics: Doing Async the Easy Way

If you've been following Ted Pattison's excellent series of Basic Instincts columns on multithreading and asynchronous behavior, you should by now be an expert on handling the issues involved in working with multiple threads in Windows®-based apps. Recently, a friend, who evidently hadn't read Ted's columns, sent me a Windows-based application that performed a very lengthy file search operation that locked the user interface while executing. Users couldn't interact with, move, or resize the form while the main activity was running, so they weren't happy. He wanted to know what he could do to make the app more responsive. The answer, of course, is to perform the work in a background thread.

I recommended Ted's series of columns to my friend, but couldn't resist fixing things up on my own in the meantime. The application and how you can safely perform a background operation with as little code as possible—both in Visual Basic® .NET 2003 and in Visual Basic 2005—is this month's topic. (Read the rest...)

Published Saturday, April 22, 2006 7:41 AM by KenG
Filed under:

Comments

No Comments