Rob Chartier ~ Contemplation...

.NET, C#, Work, etc.

News






www.flickr.com
This is a Flickr badge showing public photos from Rob & Kat Chartier. Make your own badge here.


Even Quicker Links

Google Desktop Winamp Plugin - C#

Yesterday I submitted my first Plugin for GD - .NET/C# of course.  It has basic the controls: play/pause/stop/next/prev and displays the title of the track currently playing.  I think the hardest part was to get the installer working right.  Now that I look back it was quite simple I was just looking at all the wrong places. 

All I did was take their SamplePlugin project and ripped out 90% of it, and stuff it some basic Winamp control features. 

One thing I did not like and, for the life of me, could not see how to have the items in the list respond to a single click instead of a double click.  Thus, in order to do anything with it you have to double click the items.  If Google ever approves of it, and it is put online on their site, I will repost the URL...If your really excited and want it right now, send me some feedback and I can forward  you my internal URL for it.

The Big Gotcha's:

1. Adding Google's references:  GoogleDesktopAPILib, and GoogleDesktopDisplayLib.  Make sure you have specified a "Wrapper Assembly Key File" to your plugin project PRIOR to adding those references.  Oh yes, that does imply that you have to use "sn" to generate the key file before.  You also do not need to have their C++ project included in your plugin solution.  Just the references of course.

2. Create a Plugin Installer class:

using System;

using System.Runtime.InteropServices;

namespace GoogleDesktopScreenCapture {

[System.ComponentModel.RunInstaller(true)]

public class PluginInstaller : System.Configuration.Install.Installer {

public PluginInstaller() {

}

public override void Install(System.Collections.IDictionary stateSaver) {

base.Install (stateSaver);

RegistrationServices regsrv = new System.Runtime.InteropServices.RegistrationServices();

if(!regsrv.RegisterAssembly(this.GetType().Assembly,System.Runtime.InteropServices.AssemblyRegistrationFlags.SetCodeBase)) {

throw new System.Exception("Failed to register object");

}

}

public override void Uninstall(System.Collections.IDictionary savedState) {

base.Uninstall (savedState);

RegistrationServices regsrv = new RegistrationServices();

if(!regsrv.UnregisterAssembly(this.GetType().Assembly)) {

throw new System.Exception("Failed to unregister object");

}

}

}

}

You can copy that exact class above, no changes are needed as long as it is in the same assembly as your actual plugin.  Now, in your installer open the "Custom Actions" and add the "Primary Output" to both the Install and Uninstall sections and be sure to set the "InstallerClass" to true in the properties on the newly added nodes.

3. You dont need to stuff anything in the GAC, unless maybe you have other assemblies which your stuff is using.  My entire plugin consist of a single DLL which I allowed for the default install to happen.

If you have any problems getting your .NET GD Plug-ins working feel free to use the feedback and I can try to solve some of them with you...

 

Comments

EyePulp said:

But does it go to 11?
# August 23, 2005 1:06 PM

Adnan Siddiqi said:

Hi

is This opensource plugin?i need to understand how did you add your custom control(winAMP) related inside the exising sample.

i need to make a plugin to fetch some remote data

kindly guide me
# August 24, 2005 2:05 AM

Adnan Siddiqi said:

Hi

is This opensource plugin?i need to understand how did you add your custom control(winAMP) related inside the exising sample.

i need to make a plugin to fetch some remote data

kindly guide me
# August 24, 2005 2:14 AM

Robert said:

I would love to give this a try!
# August 24, 2005 5:59 PM

Rob Chartier said:


If you want access to the installer before Google (hopefully) makes it public use the "Contact" link on the left nav. Make sure you send me your email address so I can respond.

# August 24, 2005 6:28 PM

mo said:

Hi! Im new in creating Google Desktop Plugin. Do you have any sample code(in c#) of a Plugin that enables user to simply enter text? If so, kindly email it in motmot@gmail.com. Thanks!

# January 18, 2007 10:13 AM

kurik said:

Hi! Can you send any sample code(in c#) in kurik@apriorit.com?

# July 3, 2008 2:11 PM

kurik said:

Hi! Can you send sample code(in c#) of plugin to me(kurik@apriorit.com)?

# July 3, 2008 2:30 PM

kurik said:

Hi! Can You send any sample code(in c#) of a plugin to me(vladimir.kurka@gmail.com)?

# July 3, 2008 2:36 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)