To make your new object available to AIMCC, you will need to do three things: set the UUID for your plugin, implement the IAccPlugin interface, and register with AIMCC.
In the .h for your plugin, you will see a line that looks like this:
uuid("033E6370-F0C7-4623-AF58-23F46BE4AF3C")
This is a UUID that Visual Studio has generated for you. In order for your plugin to be recognized by the AIM servers, you must replace this UUID with an "AIM Plugin Development Key" which you can obtain from the AIM Developer site. This key is simply another UUID that is known to the AIM servers, and so when you replace the existing UUID with it, it will not look much different:
uuid("6a753130-6e73-4877-516f-62686c657a68")
Next, we need to implement the IAccPlugin interface. To do so, go back to class view, and expand the selection for your plugin.

Right click on your plugin class and select Add -> Implement Interface. You will see this dialog. If AccCoreLib does not appear in the list of available type libraries, click the "File" radio button and then select acccore.dll (from the SDK's "dist/release" folder) in the "Location" box.

Use the dropdown list at the top to select the AccCoreLib type library. Then, select IAccPlugin from the list on the left, and click the '>' so that IAccPlugin appears in the list on the right. Once you have done this, click Finish.
If you look again at your plugin code, you will see that your plugin class now has 2 new methods, Init and Shutdown. Init is called when your plugin is loaded, and Shutdown is called when your plugin is unloaded. To ensure that your plugin is loaded and unloaded properly, change Init and Shutdown to return S_OK instead of E_NOTIMPL.
The next step is to make your plugin register with AIMCC. COM self-registration will already be performed for your plugin, but a couple of extra registry entries must be made so that AIMCC can find your plugin. The easiest way to do so is to use the registration utilities provided in the SDK's AccSupport.h file. If you #include "AccSupport.h", and add ACC_DECLARE_REGISTRY to your plugin definition, your plugin will be registered with AIMCC when self-registration occurs.
The code will look like this when you are done:
// Avoid warning from replacing UpdateRegistry function #pragma warning(disable: 4199) #include "AccDispid.h" #include "AccSupport.h" . . .
[
coclass,
threading("apartment"),
vi_progid("Sample.MyPlugin"),
progid("Sample.MyPlugin.1"),
version(1.0),
uuid("6a753130-6e73-4877-516f-62686c657a68")
helpstring("MyPlugin Class")
]
class ATL_NO_VTABLE CMyPlugin :
public IMyPlugin,
public IAccPlugin
{
public:
CMyPlugin()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
ACC_DECLARE_REGISTRY("MyPlugin", "1.0", "My First Plugin", "http://www.foo.com/downloadPlugins", "Foo, LLC", "http://www.foo.com")
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
// IAccPlugin Methods
public:
STDMETHOD(Init)(IAccSession * session, IAccPluginInfo * pluginInfo)
{
return S_OK;
}
STDMETHOD(Shutdown)()
{
return S_OK;
}
};
That's it! You can now build your project, it will self-register, and the next time you run an AIMCC application, your plugin will be loaded.
Next Lesson | Back to Table of Contents
Questions? Visit
http://developer.aim.com/
Last updated:
03/17/2007