Finally it worked. I updated Google Desktop from 5.1... to 5.7 and now
methods are called, but there is still some problems. I have posted it
in another entry: "Action API calls HandleAction but Google stop
working after HandleAction returns"


On 22 sep, 17:42, Daniel <[EMAIL PROTECTED]> wrote:
> I'm developing an Action plug-in using Actions API of the SDK, with
> Visual Studio .NET and c# (and vb.net)
>
> The register process works ok, aparently. At least, the registration
> gives no error, and I can use Query API and Index API without problem,
> sending events and quering ok.
> However, I have created a COM Class to implement
> IGoogleDesktopCustomAction, in c#, and nothing: the methods
> QueryInterest or HandleAction are never called.
> The problem is that there isn't enought documentation about this API,
> I think. I've "googled" in internet and there is almost nohing.
>
> Can you say what I'm doing wrong?
> Thanks in advanced
> Daniel
>
> COM Class is defined as you can see below (in a project named
> "GDSAction2", with "Register for COM interoperability" checked)
>
> using System;
> using System.Windows.Forms;
> using System.Collections.Generic;
> using System.Text;
> using System.Runtime.InteropServices;
>
> using GoogleDesktopAPILib;
>
> public enum ActionHandling: int
> {
>     ACTION_HANDLING_DEFAULT = 0,
>     ACTION_HANDLING_QUENCH = 1,
>     ACTION_HANDLING_OVERRIDE = 2
>
> }
>
>     [ComVisible(true)]
>     [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
>     [GuidAttribute("E5A04D23-6921-4ef6-B19B-6C6AA89A46AA")]
>     public interface IGoogleDesktopCustomAction
>     {
>         [DispId(1)]
>         int QueryInterest(
>         [In] Guid location,
>         [In] Guid action,
>         [In, MarshalAs(UnmanagedType.BStr)] string query_string,
>         [In, MarshalAs(UnmanagedType.IUnknown)] object item,
>         [In, Out, MarshalAs(UnmanagedType.BStr)] ref string
> actionTitle,
>         [Out, MarshalAs(UnmanagedType.BStr)] out string actionCookie,
>         [Out] out ActionHandling handling);
>
>         [DispId(2)]
>         int HandleAction(
>         [In] Guid location,
>         [In] Guid action,
>         [In, MarshalAs(UnmanagedType.BStr)] string query_string,
>         [In, MarshalAs(UnmanagedType.IUnknown)] object item,
>         [In, MarshalAs(UnmanagedType.BStr)] string action_cookie);
>     }
>
>     [ComVisible(true)]
>     [GuidAttribute("741a99f3-0e5b-46ad-b167-f56478bac042")]
>     public class SearchActions : IGoogleDesktopCustomAction
>     {
>         public int HandleAction(Guid location, Guid action, string
> query, object item, string actionCookie)
>         {
>             try
>             {
>                 MessageBox.Show("HandleAction HOLA: "+ query);
>                 //MessageBox(NULL, str, L"Action!", MB_OK |
> MB_SERVICE_NOTIFICATION);
>                 //string uri =
> ((IGoogleDesktopNotifyEvent)item).GetProperty("uri").ToString();
>                 //System.Diagnostics.Process.Start(uri);
>             }
>             catch (COMException)
>             { }
>             return 0;
>         }
>
>         public int QueryInterest(Guid location, Guid action, string
> query, object item, ref string actionTitle, out string actionCookie,
> out ActionHandling handling)
>         {
>             actionCookie = "DANI";
>             actionTitle = "DANI" + actionTitle;
>             handling = ActionHandling.ACTION_HANDLING_OVERRIDE;
>             return 0;
>
>             //string uri =
> ((IGoogleDesktopNotifyEvent)item).GetProperty("uri").ToString();
>             //actionCookie = "DANI";
>             //string extension = uri.Substring(uri.LastIndexOf('.') +
> 1);
>             //if (extension == "txt")
>             //    handling = ActionHandling.ACTION_HANDLING_OVERRIDE;
>             //else
>             //    handling = ActionHandling.ACTION_HANDLING_DEFAULT;
>             //
>             //return 0;
>         }
>     }
>
> When project is generated I can see the new class COM in the register:
>
> [HKEY_CLASSES_ROOT\CLSID\{741A99F3-0E5B-46AD-B167-F56478BAC042}]
> @="SearchActions"
>
> [HKEY_CLASSES_ROOT\CLSID\{741A99F3-0E5B-46AD-B167-
> F56478BAC042}\Implemented Categories]
>
> [HKEY_CLASSES_ROOT\CLSID\{741A99F3-0E5B-46AD-B167-
> F56478BAC042}\Implemented Categories\{62C8FE65-4EBB-45e7-
> B440-6E39B2CDBF29}]
>
> [HKEY_CLASSES_ROOT\CLSID\{741A99F3-0E5B-46AD-B167-
> F56478BAC042}\InprocServer32]
> @="mscoree.dll"
> "ThreadingModel"="Both"
> "Class"="SearchActions"
> "Assembly"="GDSAction2, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=null"
> "RuntimeVersion"="v2.0.50727"
> "CodeBase"="file:///D:/PROYECTOS/Ejemplos GoogleDesktop/GDSAction2/bin/
> Release/GDSAction2.dll"
>
> [HKEY_CLASSES_ROOT\CLSID\{741A99F3-0E5B-46AD-B167-
> F56478BAC042}\InprocServer32\1.0.0.0]
> "Class"="SearchActions"
> "Assembly"="GDSAction2, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=null"
> "RuntimeVersion"="v2.0.50727"
> "CodeBase"="file:///D:/PROYECTOS/Ejemplos GoogleDesktop/GDSAction2/bin/
> Release/GDSAction2.dll"
>
> [HKEY_CLASSES_ROOT\CLSID\{741A99F3-0E5B-46AD-B167-
> F56478BAC042}\ProgId]
> @="SearchActions"
>
> The registration process is:
>               IGoogleDesktopRegistrar gdsReg = new
> GoogleDesktopAPILib.GoogleDesktopRegistrarClass();
>                object[] componentDesc = new object[6] {
>                                                       "Title", _name,
>                                                       "Description",
> _description,
>                                                       "Icon", _icon
>                                                     };
>              gdsReg.StartComponentRegistration(_componentGuid,
> componentDesc);
>              IGoogleDesktopRegisterCustomAction spRegistrationAction;
>             spRegistrationAction=
> (IGoogleDesktopRegisterCustomAction)gdsReg.GetRegistrationInterface("GoogleDesktop.ActionRegistration");
>
> spRegistrationAction.RegisterAction(_CLSID_SearchActions.ToUpper() ,
> ACTION_OPEN_SEARCH_RESULT, null);
>              gdsReg.FinishComponentRegistration();
>
> Where:
> string _CLSID_SearchActions = "{741a99f3-0e5b-46ad-b167-
> f56478bac042}"; // GUID of COM Class
> const string ACTION_OPEN_SEARCH_RESULT = "{21B7E880-EEB5-4c3d-8E56-
> BFF2A6654E6E}";

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Desktop Developer Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Desktop-Developer?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to