The wonderful weird world of everything and nothing

aka The "Don't Panic" button!

  • A major bug in using managed Outlook command popup/buttons.

    Scenario:

    You want to create an addin to Outlook to extend the menu system so you use the VS wizard to create the addin code and then begin adding popup/button code. If you code ala standard .NET object programming and your menu has more than 1 button then you are doomed to failure due to a major 'gotcha'. Let me walk you through it and how to solve it. Here is a 'standard' vanilla code example that we all could code with our eyes shut.

    CommandPopup PopupMenu;
    CommandButton MenuButton;

    // create 1st button
    MenuButton = PopupMenu.Add(...);
    MenuButton.Caption = "Publish"
    MenuButton.OnClickEvent += ...

    // create 2nd button
    MenuButton = PopupMenu.Add(...);
    MenuButton.Caption = "Subscribe"
    MenuButton.OnClickEvent += ...

    By now you see the pattern and think all is well and good but this will NEVER work with Outlook.

    Outlook (or the CommandPopup code) maintains an ugly list somewhere of the buttons created and as soon as you create the 2nd button that code loses a reference to the OnClick event upon garbage collection. So your first invocation of the code works but upon exit is GC'd and when you go to use it the 2nd time there is no event attached to the button.

    Solution: Each button MUST be a unique object hence you must code the following (or similar to):

    CommandPopup PopupMenu;
    CommandButton [] MenuButtons;

    MenuButtons = new CommandButton[2];

    // create 1st button
    MenuButtons[0] = PopupMenu.Add(...);
    MenuButtons[0].Caption = "Publish"
    MenuButtons[0].OnClickEvent += ...

    // create 2nd button
    MenuButtons[1] = PopupMenu.Add(...);
    MenuButtons[1].Caption = "Subscribe"
    MenuButtons[1].OnClickEvent += ...

    Well, this satisfies the unique button object problem and so you would think that there is no further problems///but this doesn't work either YET.

    Each .NET object has a 'Tag' property that gets a 'standard' value and is not really used by anyone...think again! The CommandPopup/Outlook code uses this field to differentiate the buttons. Never mind that in .NET each object is a unique object and thus can be tracked individually. NOOOO! The code uses the Tag property to track each object and since each object has the standard identifier then each object 'looks' the same.

    Solution: Given each tag a unique value thus:
    CommandPopup PopupMenu;
    CommandButton [] MenuButtons;

    MenuButtons = new CommandButton[2];

    // create 1st button
    MenuButtons[0] = PopupMenu.Add(...);
    MenuButtons[0].Caption = "Publish"
    MenuButtons[0].Tag = Guid.NewGuid().ToString();
    MenuButtons[0].OnClickEvent += ...

    // create 2nd button
    MenuButtons[1] = PopupMenu.Add(...);
    MenuButtons[1].Caption = "Subscribe"
    MenuButtons[1].Tag = Guid.NewGuid().ToString();
    MenuButtons[1].OnClickEvent += ...

    NOW your code works fine! Wasn't that just so intuitive! I wasted 4 days trying to solve this and only after a late night session with the Outlook guys did we find the reasons.

    BTW, why do all the samples on the Internet work? They only have 1 button!

  • Garages sales and Mesh Networking

    Recently I had a garage sale whereby several people came by looking for 'particular' items. Unfortunately I did not have them but had many other items of interest. I began thinking of how I could expand my 'horizons' and realized that the concept of mesh networking, communities, and garages sales go hand in hand.

    Imagine a scenario where all of the garage sales in a community were meshed together so that someone looking for a particular item only had to go to one sale and if that item was not there then ask the owner of that garage sale if it was available anywhere else. The owner could then 'mesh' the other sales and ask if that item was anywhere. If it was then they could direct the buyer to the item's location. The owner would also benefit from this 'sharing' as they would also get people directed their way.

    It would turn a single 'garage' sale into a block 'garage' sale with far greater potential for the seeker and the seller.

    This is just one example of the 'community'ness of mesh networking and how it would revolutionize communities and even bring them closer together for greater things.

  • Extended MAPI (aka MAPI 1.0)

    I was doing some playing around with Extended MAPI and found it to be a very interesting object model. Very flexible and yet very convoluted. It seemed I could do almost anything I wanted and yet I began to wonder if anyone was even using this?

    So my question to you is “Have you done anything in MAPI 1.0? and if so then “What did you like or dislike about it?”
  • n Degrees of separation

    Imagine a world where everyone is connected to everyone else and there no longer is “6 degrees of separation” but rather “0 degrees of separation”. Forsaking the obvious misuses of distributing copyrighted material and pornography...simply imagine what could be done in a truly connected world!

    The concept of the “middleman” is business, or the “matchmaker” in personal relationships, or the intermediary in any form of contact would no longer be necessary. That role may be necessary in some interactions but for the most part would not be “required”. The role becomes one of a facilitator.

    My question thus becomes: “Given this type of connectivity is reality, then what would / could someone do with it?”

  • Wonderfully weird mesh networking

    Recently I ran into this idea of ad hoc wireless peer to peer networking. The idea being that anybody and everybody can instantaneously create an ad hoc wireless network simply by being within proximity to each other. Everyone knows about everyone and everybody is a friend with everybody else.

    Sounds rather Utopian but from a real world perspective this is completely possible given the right equipment, authorization, authentication, and most of all, the right software.

    I'm curious to see/find out what would happen if this type of networking actually took off and how people would use it. Imagine being able to share, discover, and basically network with anyone with whom you choose. What would you do with it?


© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker