Archive for the 'Code - C#' Category

More Fun with Interop

Now let’s say we have a “C” exported function that looks something like this:

void MyFunction(void* myData);

This, of course, is inherently unsafe, because the void* could represent anything. In the wonderful world of “C”, however, such a construct is frequently used.
We must assume that the caller knows exactly what the called function is expecting the […]

Fun with Interop

Coding with C# is fun (most of the time) and really takes a lot of the work out of stuff, like memory allocation/deallocation, that was pretty grungy in C++. Unfortunately, sometimes a new .NET component has to talk to a legacy C++ API and that’s where things can get interesting.
I want to look at […]

Closing your Database Connections

Sometimes working with a managed language like C# can make you lazy. Having cut my programmers teeth on C++, I learned very early that if you “new” something you must also “delete” it. Forget and you get a memory leak.
After moving to C#, however, I occasionally become complacent and begin to think that the garbage […]

Parsing Amazon Web Services (AWS) with C# and .NET

Amazon web services are one of the most feature and information-rich sources
of queryable product data available. They even have user and editorial reviews that
you can present to your customers to induce them to buy through your site. The
best part is that it’s free for developers (Get it at Amazon.com).
Here I want to present a short […]

Using C# to parse XML feeds.

What with the big push to have XML adopted as a cross-everything data format, it seems like it should be fairly straightforward to parse an XML file in .NET.  For the most part, I would say that it is, but I ran across a situation recently that was a bit difficult to solve — mostly […]

Hosting an Active-X Control on an Outlook Inspector page with C#

This article is going to carry on some ideas from earlier posts. Those posts dealt with how to customize an Outlook Contact by adding a custom tab. If you missed the earlier information, you can catch up on it here: http://www.midniteblog.com/2007/04/12/writing-an-outlook-add-in/.
Now we are going to try to something with the blank tab we added. Let’s […]

Writing an Outlook Add-in with C# (Epilogue)

Outlook Add-in Deployment issues
So after you’ve built your new whiz-bang Outlook Add-in, you will want to deploy it to your user’s machines. It runs fine on your development machine, but when you copy it (or use the installer to install it) to another box, it doesn’t run so fine. Here are some deployment issues I […]

Writing an Outlook Add-in with C# (Part 4)

In the last 3 sessions, we have developed an Outlook Add-in that adds a tab to a Contact window when it is opened. We began to discuss some further issues with which we must grapple.
Problem #1. There is a Microsoft documented problem with Outlook hanging in memory after closing it even if an Outlook Add-in […]

Writing an Outlook Add-in with C# (Part 3)

To this point we have an Outlook Add-in shell written.  We have verified that Outlook sees it and that Outlook loads it when it starts up.  (See Part 1 and Part 2 if you missed them). Now we are going to make it do something interesting inside Outlook. 
To start with, let’s add a tab to the […]

Writing an Outlook Add-in with C# (Part 2)

So far we have created an Add-in for Outlook with the Visual Studio wizard.  If you missed that, you can go back to Part 1. 
Go ahead and build it and make sure there is no problem there.  If all is well, you should have a bin\Debug directory underneath your MyAddin directory and a MyAddin.dll in it.  […]