article

An introduction to using Windows Image Acquisition (WIA) via C#

A brief overview on getting started with the Windows Image Acquisition (WIA) library in C#

avatar
Richard Moss
article

Resolving compile error "Interop type cannot be embedded. Use the applicable interface instead"

When working with COM interop libraries you may receive the compile error "Interop type cannot be embedded. Use the applicable interface instead". This article describes two common causes of this error and how to resolve it.

avatar
Richard Moss
article

Reading cookies from Internet Explorer

A quick article on pulling cookies from Internet Explorer or the WebBrowser control, useful for if you want to make custom HTTP requests reusing cookies from existing sessions

avatar
Richard Moss
article

Retrieving font and text metrics using C#

In several of my applications, I need to be able to line up text, be it blocks of text using different fonts, or text containers of differing heights. As far as I'm aware, there isn't a way of doing this natively in .NET, however with a little platform invoke we can get the information we need to do it ourselves as this short article demonstrates.

avatar
Richard Moss
article

Working around System.ArgumentException: Only TrueType fonts are supported. This is not a TrueType font

We recently created a a drop in replacement for the System.Windows.Forms.FontDialog component to avoid crashes when a user tries to select an invalid TrueType font.

avatar
Richard Moss
article

Adding Double Click support to the ComboBox control

I was recently using a `ComboBox` control with the `DropDownStyle` set to `Simple`, effectively turning into a combined text box and list box. However, when I wanted an action to occur on double clicking an item in the list I found that the control doesn't actually offer double click support. I suppose I should have just ripped out the combo box at that point and went with dedicated controls but instead I decided to extend `ComboBox` to support double clicks.

avatar
Richard Moss
article

How to be notified when your application is activated and deactivated

I recently had a requirement where a user was able to perform an action externally to my application, and my application then had to detect this for processing. I could of course just had a poller running away in the background to check, but as the requirement also needed user input, why not just wait until the user switched back to my application, then check and deal with accordingly? This article describes how to intercept the `WM_ACTIVATEAPP` message from your C# application and put it to good use.

avatar
Richard Moss
article

Extracting email addresses from Outlook

A sample project which shows how to extract email addresses from Outlook via C# and Interop.

avatar
Richard Moss
article

Error 80040154 when trying to use SourceSafe via interop on 64bit Windows

Working around exception "Retrieving the COM class factory for component with CLSID {783CD4E4-9D54-11CF-B8EE-00608CC9A71F} failed due to the following error: 80040154." when trying to connect to SourceSafe via interop.

avatar
Richard Moss