Hello, I'm trying to use Action API but I'm having many problems. Can
you help me?
At this moment Google calls my method QueryInterest and this works ok.
Even If testing it I put a MessageBox in that method, it shows ok and
when it returns Google shows the results: it's waiting my method to
finish. I think that's ok.
However, when I click in one result handled by my plugin Google calls
my HandleAction (ok) but when it returns Google hangs, stop
responding:
can't stablish connection with server on 127.0.0.1:4664
If I do ctr+ctr -> modal window says: Google Desktop is not running.
What it's wrong on this code? Is it something related to what
documentation says: "Please note that the custom action plug-ins will
be loaded in a COM multi-threaded apartment."
But this COM is created with ThreadingModel=Both.
Thanks in advanced
Regards
Daniel
[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("QueryInterest: " + query);
}
catch (COMException)
{ }
return 0;
}
public int QueryInterest(Guid location, Guid action, string
query, object item, ref string actionTitle, out string actionCookie,
out ActionHandling handling)
{
try
{
string uri =
((IGoogleDesktopNotifyEvent)item).GetProperty("uri").ToString();
actionCookie = null;
actionTitle = "DANI2: " + actionTitle;
string extension = uri.Substring(uri.LastIndexOf('.')
+ 1);
if (extension == "myExt")
{
//MessageBox.Show("QueryInterest: " + query); //
testing...
handling =
ActionHandling.ACTION_HANDLING_OVERRIDE;
}
else
handling = ActionHandling.ACTION_HANDLING_DEFAULT;
}
catch (Exception)
{
actionCookie = "";
handling = ActionHandling.ACTION_HANDLING_DEFAULT;
}
return 0;
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---