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