M a r k P i t . c o m

"After three days without programming, life becomes meaningless." - The Tao of Programming

What do you use to author autorun.exe for CD-ROMs?

clock April 27, 2004 15:56 by author Mark
I have used Flash 5 in the past to author autorun executables for CD-ROMs. It is nice because it is easy and there is no runtime required. Macromedia has basically killed this usage with Flash MX though. You can't execute apps unless they are in a "fscommand" subdirectory and you can't pass commandline arguments to those apps either. Thanks a lot Macromedia!


MiniStumbler

clock April 26, 2004 13:30 by author Mark
There is a cool app called MiniStumbler that lets you search for and document wireless networks with your PPC. A new version has just been released and it now supports more wireless cards, including my Socket CF Wireless card. Now I just need to get a bluetooth GPS!


Outlook and .Net

clock April 21, 2004 22:48 by author Mark

If you are developing an addin for Outlook in C# or another .Net language or even just using COM from .Net, you should be cleaning up your COM objects (duh!). But, setting them to null is not enough. You must use the System.Runtime.InteropServices.Marshal.ReleaseComObject method to remove all references to that COM object. Here's a little class that you can use so you don't have to retype the code all over the place.

using System;
using System.Runtime.InteropServices;
namespace Utils{
    public class ComUtils {
        public ComUtils() {
   
        }
        /// <summary>
        /// Force a release of the COM objects and do garbage collection.
        /// If you are using Outlook objects, this will allow Outlook to 
        /// exit cleanly after you are done with it.
        /// </summary>
        /// <param name="comObjects">Array of COM objects to release, 
        /// be sure to add the objects to the array in the order you want 
        /// them destroyed!</param>
        public static void Release(object[] comObjects) {
            try {
                for(int i = 0; i<comObjects.Length;i++) {      
                    if(comObjects[i] != null) {
                        try{
                            // loop until the reference count is zero 
                            while(Marshal.ReleaseComObject(comObjects[i]) > 0);       
                        }
                        catch(System.InvalidCastException){
                            // the object was not a COM object
                            // no big deal, just go on to the next one
                        }
                        catch(System.NullReferenceException){
                            // object was null, still no big deal
                            // go on to next one
                        }
                        finally{
                            comObjects[i] = null;
                        }
                    }
                } 
            }
            catch (Exception ex) {
                // insert your exception handling here
            }
            finally {
                // force a garbage collect to occur
                GC.Collect();
                // Wait for the thread processing the 
                // queue of finalizers to finish
                GC.WaitForPendingFinalizers();
            }
        }
    }
}

Just create an object array of your COM objects (in the order you want them released) and pass them to the Realease method of this class. For example:


ComUtils.Release(new object[], {outlookMailItem, outlookNameSpace, outlookApplication);

 The GC.Collect() and GC.WaitForPendingFinalizers() are very important. I was recently working on an Outlook Addin and didn't have those two lines in there. Outlook would NOT shut down completely until I added them in!



"War Blogging"

clock April 16, 2004 21:49 by author Mark
Check out Jeffrey Palermo blogging from the middle of a war! He is in the Army Reserve and has been in the middle east for the past year. I was in the Marine Corps Reserve in the early 90s and served in Operation Desert Storm. I would have given anything to be able to bring a laptop along and get on the Internet to talk to family back home. It just wasn't available. I think it is pretty cool that he is able to talk to his wife on a daily basis. That has to make it a lot easier on her. I wasn't married at the time (I was only 21), but I know it was a rough time for my parents because most of the time they didn't know if i was OK or not. Oh and before anyone says anything like “how can this guy have time to be on the Net during a war?” believe me, even in the middle of a war, there is a LOT of downtime and that is probably some of the most difficult time to get through. Way too much time to think, much better to keep busy! Anyway, thanks for doing your duty Jeff, keep your head down and get home safe next week!


Windows Media Player "Album Info" Jacked Up

clock April 15, 2004 22:22 by author Mark

OK Microsoft, what's the deal? I put OutKast's “Speakerboxxx/The Love Below” Disc 2 in my CDROM drive to rip the tracks and when Media Player downloads the track info about half the tracks are in the wrong order?!?! There is even one completely missing! So, I went to the All Music Guide website to see if they had them in the right order and they do, except for that missing track. I'm pretty sure that is where Media Player gets its info from, so what's going on?

Next thing I did was click on “Find Album Info”, that found the tracks in the right order, except for that elusive missing track again. So I just shifted the last few track titles down one and typed in the missing title for track 17 and it is all fixed, but it is still annoying that I even had to do it!



Visual Source Safe over the Internet

clock April 15, 2004 15:48 by author Mark
Tim Heuer found a pretty cool project that allows you to use VSS over the Internet! I have used CVS and Subversion that way before, but I was amazed that someone has wrapped up VSS and turned it into a client/server system. Looks like it can even integrate into VS.Net.


iPAQ 2200 Series SDIO Driver Update

clock April 13, 2004 15:18 by author Mark
HP has released an update for the iPAQ 2200 Series. It fixes some power consumption problems with SDIO devices and a “SD Card initialization issue”. Whatever that means. They don't seem to explain these updates very well.


Linksys Router

clock April 12, 2004 23:07 by author Mark
After upgrading the firmware on my linksys router I had some problems, but by turning off UPnP and disabling logging, the router hasn't required a reboot for a few days now. Hopefully Linksys will release a more stable firmware revision soon!


Printing the .Net TreeView Control

clock April 9, 2004 11:05 by author Mark

I just published my first article on Codeproject. I looked for sample code for quite a while to print the TreeView control and just never found anything that quite did what I wanted. I found a lot of people asking how to do it though ;) So, I decided to write it myself and post it so others can use it too. I hope it is useful to someone!

I'll also keep a copy here.



HP iPAQ H6300 rumours

clock April 7, 2004 12:23 by author Mark
Is anyone else as excited as I am about this rumoured Pocket PC Phone from HP? Not too sure if I'm ready to shell out the estimated $600 to buy it, but with some luck, maybe T-Mobile will have some kind of rebate on it :)


About the author

Mark Pitman is a dad, husband and software developer. Not always in that order, but I try!



RecentComments

Comment RSS

Sign in