Plug-in Development for Google Desktop

Category:Requests for deletion#Plug-in%20Development%20for%20Google%20Desktop Category:Books to be broken into subpages

Getting Started

Things you need

How to get started

You need to create a COM object.

What is a COM object and why do I need to create it?

GD uses COM objects as plugins. Actually these are like ActiveX components. They are meant to be reusable.

How to create a COM object

In Visual Studio, create a C# Class Library.

Preliminary code for the Class Library project

You should implement two (2) methods:

static void ComRegisterFunctionAttribute(Type t) {
include initialization code here
}

This function is called whenever you register your COM object to the system. You can put initialization code here, like code that will register our plugin to GD (Details later).

static void ComUnregisterFunctionAttribute(Type t) {
}

This function is called whenever you unregister your COM object.

You should have the following statement:

using System.Runtime.InteropServices;

What kind of files are created when I compile my Class Library project?

After building your Class Library project, Visual Studio will generate the following file types in your output folder: .dll and .tlb

The .dll file generated is actually a COM object that we need to register to the system.

How to load/register a COM object

Use: regasm [dllfile] /tlb

Regasm.exe is located in your .Net Framework bin folder.

What method/code is first executed after I load a COM object?

The system makes a call to ComRegisterFunctionAttribute so it is necessary that you implement this method. It is here where we put our initialization, like a block of code that will register our plugin to GD.

Registering the plugin to GD

try {
GoogleDesktopRegistrarClass registrar = new GoogleDesktopRegistrarClass();
// Start component registration by specifying our attributes
object[] descriptions = {
"Title", pluginName,
"Description", pluginName,
"Icon", ""
};

registrar.StartComponentRegistration(controlGuid, descriptions);

IGoogleDesktopRegisterDisplayPlugin displayRegistration = 
(IGoogleDesktopRegisterDisplayPlugin)

registrar.GetRegistrationInterface("GoogleDesktop.DisplayPluginRegistration");

displayRegistration.RegisterPlugin(controlGuid, false);
// Done with component registration.
registrar.FinishComponentRegistration();
}
catch (Exception e) {
MessageBox.Show("Exception thrown during registration. Description=" + e.Message);
}

What happens when my plugin is registered in GD?

Your plugin will appear in the add/remove panel list in Google Desktop.

Advanced Topics

Clipboard

To do:

Category:Wikibooks pages with to-do lists Category:Book:Plug-in Development for Google Desktop#%20 Category:Subject:Computer programming libraries#Plug-in%20Development%20for%20Google%20Desktop Category:Subject:Computer programming libraries/all books Category:Subject:Computer programming/all books Category:Subject:Computer science/all books Category:Subject:Computing/all books Category:Subject:Books by subject/all books Category:Subject:Computing/all books Category:Subject:Books by subject/all books Category:Book:Plug-in Development for Google Desktop#%20 Category:Book:Wikibooks Stacks/Books#Plug-in%20Development%20for%20Google%20DesktopCategory:Shelf:Computer programming libraries Category:Shelf:Computer programming libraries/all books Category:Shelf:Computer programming/all books#Computer%20programming Category:Shelf:Computer science/all books#Computer%20science Category:Department:Computing/all books#Computing Category:Alphabetical/P Category:Freshly started booksCategory:Books by completion status/all books
Category:Alphabetical/P Category:Book:Plug-in Development for Google Desktop Category:Book:Wikibooks Stacks/Books Category:Books by completion status/all books Category:Books to be broken into subpages Category:Department:Computing/all books Category:Freshly started books Category:Requests for deletion Category:Shelf:Computer programming/all books Category:Shelf:Computer programming libraries Category:Shelf:Computer programming libraries/all books Category:Shelf:Computer science/all books Category:Subject:Books by subject/all books Category:Subject:Computer programming/all books Category:Subject:Computer programming libraries Category:Subject:Computer programming libraries/all books Category:Subject:Computer science/all books Category:Subject:Computing/all books Category:Wikibooks pages with to-do lists