Archive for the ‘Software Development’ Category

Open AIM 2.0

Thursday, March 6th, 2008

Open AIMWith AOL’s recent announcement on Open AIM 2.0 now live and getting lots of great attention, I thought I should write a quick post on it. This is truly exciting news. We are dramatically expanding our community when we open things up like this. So with that, I want to say “Welcome” to all the great developers out there. Here is this incredible AIM network that you can now use and build on.

I have actually been a part of the AIM core team for a number of months now, so I am available to help answer questions on Open AIM. I can now claim to have written code in imapp.dll, acccore.dll, coolcoreXX.dll, and xprtX.dll. Lastly, this guy sits next to me.

There are more great things to come.

Open AIM: Modeless Window Support for Plugins

Sunday, December 30th, 2007

Have you ever wondered why tab and other navigation keys don’t work in some of the modeless dialog windows created by plugins? The reason for this is because Windows requires applications to call IsDialogMessage() for the currently active modeless window in order to translate the keyboard messages into dialog navigation commands.

This is relatively easy to implement in a standalone application since the code is all compiled and built together. However, in a plugin world you have to create an API to support this since it requires the cooperation between the hosting application, that owns the message pump, and the plugins, that know which modeless window is currently active.

The Open AIM SDK added support for registering the active dialog back in version 1.3 via a property called IAccPluginInfoProp_Windows. This property accepts an array of UINTs that are the window references. In the Windows environment you only have to provide a one-element array with the window handle of the currently active modeless dialog window or an empty array.

Open AIM clients need to listen for changes to IAccPluginInfoProp_Windows and keep track of the currently active dialog window in any plugin. On every window message, Open AIM clients should call IsDialogMessage() if it has at least one active modeless dialog window registered. If the message is handled, then the client is done otherwise the client can continue on with its own processing of the message. If all plugins are working correctly, there should only be one active modeless dialog window at a time even if there is more than one open.

I created a handy little class that you can use to make this easy to manage in your plugins. Here is a part of the header (Download the full source here):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class COpenAIMPluginWindowReg
{
public:
    // Call this once from the first instance of your plugin and
    // a second time, with a null pointer, when the last instance is shutdown.
    static void SetPluginInfoPtr(IAccPluginInfo *pPluginInfo);
 
    // Call this from WM_ACTIVATE
    static void OnActivate(HWND hWnd, WPARAM wParam);
 
private:
    static CComPtr<IAccPluginInfo>  s_spPluginInfo;
 
};

As you can see, this class has just two static methods and thus very simply to use. You call COpenAIMPluginWindowReg::SetPluginInfoPtr(pPluginInfo); from the first instance of your plugin. I typically call this from the IAccPlugin::Init() method and keep track if the number of instances of my plugin that are running. You must also call COpenAIMPluginWindowReg::SetPluginInfoPtr(NULL); when the last instance of your plugin is shutdown.

Then, in every modeless dialog window you create, add a handler for the WM_ACTIVATE message and call:

    COpenAIMPluginWindowReg::OnActivate(hWnd, wParam);

The OnActivate static method takes care of maintaining the IAccPluginInfoProp_Windows property for your plugin as the window is activated and deactivated.

I have released this source under an MIT style license. See the source files for more information. Again you can download the full source here.

Questions? Comments?

Open AIM: How to register a plugin command

Monday, December 17th, 2007

Hello again. I am back. Today I am starting a new series of posts on Open AIM. For this first post, I will start by introducing a handy little function similar to the one I wrote for my plug-ins that makes it easy to register commands that your plug-in will handle.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// The following code is public domain. Written by Gus Verdun
static void RegisterPluginCommand(IAccPluginInfo * pluginInfo, 
                                               int id, UINT flags, 
                                               LPCWSTR pCommand)
{
    CComPtr <IAccCommand> spCommand;
    pluginInfo->AddCommand(id, &spCommand);
    if (spCommand)
    {
        CComBSTR str(pCommand);
        put_Text(spCommand, str);
        put_Flags(spCommand, (AccCommandFlags)flags);
    }
}

I normally call this function from the IAccPlugin::Init method, but you can call it at any time you want to add a command. The first parameter is the IAccPluginInfo interface pointer that is passed to you on the Init() call. The second parameter is the command identifier that is assigned by you and handled in your plugin’s IAccCommandTarget methods. The third parameter, flags, are the AccCommandFlags that let you indicate where you want this command to appear in the UI. Finally, the fourth parameter is the actual text that will be displayed in the client’s UI.

Here is a simple example to define a command that will show only in the plug-in settings page.

RegisterPluginCommand(pPluginInfo, -1, 
     AccCommandFlags_PreferencesUi, 
     OLESTR("Settings...") );

For localization purposes, you can easily change this function to load the command string from a resource. I will leave that as an exercise for you to try.

Hope this helps. Comments? Questions?

Hypothetical BOT Idea #145

Thursday, August 30th, 2007

AIM lets you create BOTs. BOTs are essentially custom clients that can sign-on and appear on the AIM Network so that anyone can send them IMs and put them on their buddy list. BOTs generally respond to commands and send their results back.

Here is an idea I doubt would be allowed by AOL’s Terms of Service (TOS). However, I am not a lawyer and like most ideas go, they can always help with the next big idea.

What if you had a Screen Name (SN) that you didn’t need it anymore? Rather than letting it go away unused, why not trade it (remember: hypothetical)?

So here is my BOT idea. First, some simple definitions: The Dealer is the one running the web site and BOTs used to trade SNs. The Seller is anyone who has a SN to trade. The Buyer is anyone that wants a SN that is available for trade.

Sellers register their SN with the Dealer and hand over the password (again: hypothetical). The Dealer takes control of the SN (that’s called assignment, right? It’s a no-no in AOL’s TOS, bummer) and turns it into a BOT.

The Dealer has a BOT and web site that Buyers go to and search for a screen name they want. SNs can be tagged with attributes so that you can search for things that the SN stands for like, sports, football, animal, celebrity, random guy, etc. Each SN that is for trade is also running as a BOT and you can IM the BOT your offer to trade. Buyers know the SN is for trade because the BOT keeps saying “This SN is for trade. Please make an offer”, and provides a verification link on the Dealer’s web site.

When the Seller likes an offer, he tells the Dealer to close the deal. The transaction completes and all parties are happy.

It definitely makes use of the AIM Network in an interesting way.

WDYT?

Busy All Around

Thursday, July 26th, 2007

Been working long hours the past couple of weeks plus doing some home finishing projects around the house.

It’s crunch time at the office. I will be very busy for the next few weeks. This is where the fun is. I like it when you get to do things that you have never done before and see it all materialize progressively in front of you. I get better at it each time. It’s incredible fun to be in a controlled chaos mode. I highly recommend it. This is when you stop looking at the clock unless it’s after 9PM. I wish every day was like this at work; at least let it be 6PM when I take that first look at the clock.

PeerSketch is limping along in all this. I have not completely abandoned it yet. Rest assured, it will simply be advancing at a slower pace than expected.

PeerSketch Development Begins

Friday, July 6th, 2007

I will formally start the development of PeerSketch this Sunday night (7PMish EST). You can get instant updates on my current activity on twitter. More detailed development updates will be posted here. The rest of this posts covers the technology I will use, how AIMcc supports this plug-in, and some of my first steps.

This plug-in will be developed in C++ using ATL and WTL for the application UI. All drawing will be done via GDI+ which exists on Windows XP and above (Microsoft provides an installer for older OSs like Windows 2000). Expat will be used for XML based data transfer. Lastly, AIMcc will provide the plug-in and custom session support.

You send and receive pictures, files, voice, video, etc. to and from your buddy with AIM. These features make use of a common transport mechanism that handles firewalls, does authentication, manages the connection, and transfers the data. One of the unique features in AIMcc is the ability to create custom sessions that take advantage of this transport mechanism in a custom way. You can use it to implement your own version of file transfer or create new interactive sessions of any kind. I will be using this support for this plug-in. You can read more about it here. The complete documentation for AIMcc is here.

The first things I will do is develop a “proof of concept” plug-in and a test environment. The plug-in will exercise the custom session support in AIMcc and answer some questions on the performance and data formats I will get in the two modes I plan to use custom sessions in, which are, Offer/Answer and Stream. Each mode has some trade-offs that I want to identify. The test environment will be a standalone application that I will use to test the drawing and communication functions before I make them a plug-in. This will make it easier to test. As you can see I have plenty to do.

See you Sunday night on Twitter.

I Want to Write Software For Things Like This

Saturday, March 24th, 2007

Moto Q

Even My Website Needs A Little QA

Friday, March 9th, 2007

I found a bug yesterday in the beta registration code on my website. The simple description is that all subsequent guest keys obtained after the first one were invalid if they were obtained within minutes of each other from the same IP address. (Yes, that’s at least three features in that one sentence.)

So, this explains why a registration would fail on the second and third product. I only saw this happen about two or three times in the past three months which is about as long as I have been offering more than one product.

This is fixed. You can register for all of my products at any time. Enjoy.

On-Demand To the Rescue

Wednesday, October 25th, 2006

Battlestar GalacticaToday was the first time I actually bought a TV episode online. I never thought I would need it. But I figured, hey, its available, not too pricey, and I just had to make sure I didn’t miss the previous episode of Battlestar Galactica. Bought it on iTunes for a $1.99. Downloaded and watched it commercial free. Is it me or is it truly sold in wide-screen format? What fun.

Why did I break down and buy an episode? Well, my DVR box failed to record it when it first aired. Was it programmer error? I’d like to think no, but I am not sure what happened. I have been too busy to QA my own DVR I guess. Luckily, iTunes saved me.

My DVR. Is it time to replace it?