MSI installer troubles...
Saturday, January 15, 2005, 02:56 - Programming
The customers of my Outlook Addin had difficulties getting the buttons visible in Outlook. They do not have local admin privileges so they could not install the addin themselves. After an admin installed the addin the buttons still did not appear. In the COM Add-ins overview within Outlook it showed that the addin could not be loaded.In the end this turned out to be caused by the fact that the addin was added to the registry under HKEY_CURRENT_USER. After changing this to HKEY_LOCAL_MACHINE in the installer project the installation went fine.
The MSI installer created by Visual Studio .NET 2003 allows the user to choose whether to install for the current user only or for everyone on the computer. I spent quite some time trying to figure out how to read the chosen install type to use it in conditional registering of certain keys in the registry. It turns out you cannot get this property and I wonder why Microsoft includes that choice at all at run-time.
Only today I found out that when you create a new Addin in Visual Studio, the wizard gives you the choice to install the addin for the current user only or to install it for everybody. Very weird that you have to make that choice when you create a new project and not when the end-user runs the installer.
ONC RPC client
Tuesday, January 11, 2005, 03:34 - Programming
Last week I developed an RPC client to send events from an application on a Windows server to another application running on a UNIX server. The server was using ONC/RPC (RFC 1831) and I had to create a simple console application with a couple of command line parameters.I hadn't decided yet on an implementation language and I was looking around for available RPC libraries because you do not want to reinvent the wheel by coding the low level communications again. I also had only one week to complete the project.
I came across a few commercial alternatives (Netbula ONC RPC (C++, $750), Netbula JavaRPC (Java, $850), Distinct ONC RPC / XDR for .NET (C#, $1,495 plus $50 per deployment)) and tried them out, but they all had some or more problems.
I finally decided on the open source Remote Tea ONC/RPC for Java.
This is a LGPL library so no need to go through the trouble of purchasing a license for the company. Java is a bit slower than C++ but it does the memory management for you, which is a great plus for a quick and dirty hacker like me :)
I couldn't get the Remote Tea jrpcgen RPC protocol compiler to work on the .x protocol files I received, but after looking at their examples and the outputs of some of the other development kits I created the interface classes myself. Then I coded the main class to do the RPC calls based on the provided command line parameters and a few default values defined in a .properties file.
Soon I had a working Java executable that also turned out to be working correctly!
It just needed a little fine-tuning and today I created the source and binary distribution .zip files as well as the documentation. Another project successfully completed!
Another small .NET project
Friday, December 17, 2004, 01:29 - Programming
Today at work I had to do some performance testing on our intranet. When we use a java applet on the intranet, it takes very long to load the homepage. We suspect that it is caused by the virus scanner, because when you turn that off, it seems to load faster.But to prove anything we of course need hard measurements. First I tried using a web stress tool, but it appears to not load up the java applet at all, as the response times are too short.
So I decided to whip up a simple .NET tool using the Microsoft Internet Explorer ActiveX component as described in this article on c-sharpcorner.com.
When you load a page using the Navigate method however, the call is done asynchronously so the call immediately returns. This makes it impossible to get relevant timing.
So I used the Navigate2 method and added an event handler to the NavigateComplete2 handler. That event is fired multiple times before the page is fully loaded, so I had to trick it a little to get the last event as the total time needed to load the web page.
But now I can select how many times the web page should be loaded and I collect a nice min/avg/max load time. Timing is written to a log file for later analysis. Simple, but it seems to be capable of doing what we need.
Only problem we haven't tackled yet: how to get the plugin to use the Sun java virtual machine instead of the MS VM.
BTW: I love the way you can add event handlers in the .NET 2003 IDE! After you type "axWebBrowser1.NavigateComplete2 += " the IntelliSense autocomplete kicks in, and by pressing TAB twice, you have added a handler with the correct signature. Now you just need to add your code there.
BTW2: Here it is promised that IntelliSense in Visual Studio 2005 will be even greater! Still need to wait half a year for that one though...
msoControlSplitButtonPopup
Thursday, December 9, 2004, 02:29 - Programming
Today I continued with my Outlook plugin in .NET project. All required features are now present and there even is a configuration screen to edit the settings and store them in the Windows Registry. So now I have two buttons in the Outlook standard bar: one to perform the actual action and one to display the configuration screen.I thought it would be cool to combine these into a so called msoControlSplitButtonPopup, just like e.g. the New Mail button in Outlook or the font color selection in Word: when you press the button the default action occurs but when you click the little down arrow on the right hand side of the button, a menu pops up and you can select other actions.
After a lot of experimenting and googling I unfortunately came to the conclusion that this is not possible. This specific button type is only available to Microsoft itself, they did not make it available through the addin API. The customer doesn't mind because he is already happy with the functionality I offered him, but it would have been very cool to have it under a single split button popup....
I'm still thinking about what other possible MS Office addin I could make, because I am very enthousiastic about it and would love to play around with this material some more. I'm also interested to play around with .NET Remoting so perhaps something challenging will come up involving a client-server setup.....
Outlook plugin in .NET
Friday, December 3, 2004, 14:32 - Programming
Yesterday at work I created an MS Outlook plugin using Microsoft Visual Studio .NET! The basics are incredibly simple, just create a new addin project and select which Office application you want to create the addin for.Then came the harder part: adding a button to the toolbar. I found an example, but somewhere along the way it stopped removing the buttons when I shut down Outlook, so now I have over half a dozen of stale buttons that cannot be deleted anymore :(
I finally found out that you can also add buttons non-permanently. So everytime Outlook shuts down, this button is removed again. Just what I want!
Then came the actual business: connecting to a database, fetching data from it, creating new emails with attachments and marking the emails as sent in the database. In my case the emails need to remain in the Drafts folder as they must manually be signed with PGP , but you could also send them immediately. Then you could also add a timer to the project and have emails sent comletely automatically as long as an instance of Outlook is open....
The more I work with .NET, the more respect I gain for it... In the early days I was skeptical about MS duplicating Java in their own way: limiting a cross-platform environment to Windows only. But now that I have worked with it some more, and also came across some limitations of Java, I think they did a pretty good job! For Windows application development it definitely is very decent.
Back