Articles by Eric

Getting the Host's Main Window Handle in an Office Add-in

By Eric — 1 minute read

Sometimes you want the window handle of the host application when you're writing an Office add-in. Excel includes that as a property of the Application object in newer versions of the object model, but Word and PowerPoint don't. I seem to remember some sample code from Microsoft that suggests using …

Read more...

Paste Special Macro for Word

By Eric — 1 minute read

I sometimes wonder how often the default paste operation in an application is appropriate. Maybe I'm abnormal (maybe?) but it seems like 73.2% of the time, I want pasted text to match the formatting of where it is going rather than where it came from. I guess the exception …

Read more...

Why StringComparison.Ordinal Is Usually the Right Choice

By Eric — 2 minute read

A question that arose in response to my previous post (about how string comparisons can produce unexpected results when done in a culture-sensitive way) was Which is right, StringComparison.Ordinal or StringComparison.InvariantCulture? The short answer: StringComparison.Ordinal.

There is a good article explaining the differences between the StringComparison enum …

Read more...

Unicode Surprises

By Eric — 2 minute read

I got a defect from QA today saying that our product was unable to track files in paths containing Unicode characters. I'll admit that I was skeptical. I had just tried that myself the other day and it worked perfectly. Trying it again today also worked perfectly, but the QA …

Read more...

.NET BackgroundWorker Summary

By Eric — 3 minute read

The System.ComponentModel.BackgroundWorker class makes it easy to code a long running operation with the ability to provide progress, cancellation, and notification of completion. It is particularly nice for UI because while the long running operation executes on a thread pool thread, notifications of progress and completion are marshalled …

Read more...

Coming Up Gadget - A Windows Desktop Gadget

By Eric — 1 minute read

Download

Download Gadget
Version 0.9.3
08 Jun 2010
Around 20 KB

Coming Up Gadget is a reminder tool for upcoming events for Windows Vista or Windows 7. It retrieves events either from Microsoft Outlook or a Google Calendar account (including Google Apps). Coming Up is intended to remind …

Read more...

Temporary CommandBar Customizations in Word

By Eric — 3 minute read

It's common for an Office add-in to put some custom menu items or toolbar buttons in the UI of the hosting application. The method to call to do this is CommandBars.Add. It is also typical that you'd like those customizations to appear so long as the add-in gets loaded …

Read more...

Them Newfangled Cellphone Things

By Eric — 4 minute read

I have to admit to being a bit of a Luddite when it comes to cell phones. In spite of being in the generally gadget-friendly demographic of software engineers, and someone who bought the very first Palm Pilot model within days of its launch, I've not yet owned a cell …

Read more...

Sleep Mode from .NET

By Eric

I have a little backup program that I wrote that includes the ability to shut down the machine when a backup is complete. I wanted to add the option of putting the machine to sleep instead of shutting down, but it took me a while to figure out how to …

Read more...

Culture Shock

By Eric — 3 minute read

Over twenty years ago, I moved from Oregon to Utah to start going to school at BYU. As we were driving to Provo from the north, my mom, who had been born in Utah, commented, "This place right here is called the point of the mountain."

"That's stupid, there's nothing …

Read more...