[Mono-dev] AppActivate and System.Windows.Forms.SendKeys on Ubuntu 10.10

Quandary quandary82 at hailmail.net
Wed Mar 16 08:37:38 EDT 2011


Hi,

Question:
Is System.Windows.Forms.SendKeys implemented and working on Ubuntu Linux ?

I try to control JD-GUI with it, but the keys don't arrive, neither do 
they arrive in gedit.
They do arrive in Notepad on Windows using the same program, and they 
work with JD-GUI on Windows, using the same program.

Or does it need any library installed, such as XTest/XFakeEvent ?


And BTW, Microsoft.VisualBasic.Interaction.AppActivate("Window Title") 
throws not implemented...

You can use the functions:
      static Window FindWindow(Window top, char *name)
      static void GetFocusedWindow(void)
 From xvkbd -> in file xvkbd.c
Basically, all you need to do is save the mouse position, find the 
target window position & rectangle, and press the left mousebutton 
somewhere on it with mousedown & mouseup via xsendevent, then restore 
the mouse position.

I can supply left + right mousedown + mouseup,
I have appended cMouse.cs and the dependencies: XorgAPI + XorgStructs.

And when I loop through all processes, as shown below, I don't get a 
WindowTitle anywhere...
(using mono 2.10.1 on Ubuntu)
--------------------------------------------

         public void GetProcesses()
         {
             System.Diagnostics.Process[] processlist = 
System.Diagnostics.Process.GetProcesses();

             string str = "";
             foreach(System.Diagnostics.Process theprocess in processlist)
             {
                 Console.WriteLine("Process: {0} ID: {1} WindowTitle: 
{2}", theprocess.ProcessName, theprocess.Id, theprocess.MainWindowTitle);
                 str += string.Format("Process: {0} ID: {1} WindowTitle: 
{2}", theprocess.ProcessName, theprocess.Id, theprocess.MainWindowTitle);
                 str += Environment.NewLine;
             }
             MessageBox.Show(str);
         }

--------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110316/97af9489/attachment-0001.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cMouse.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110316/97af9489/attachment-0003.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cXorgAPI.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110316/97af9489/attachment-0004.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Structs.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110316/97af9489/attachment-0005.pl 


More information about the Mono-devel-list mailing list