c# - Is there any way to copy a text from another program without Select it? -


i want copy text other program, in program ctrl+a considered other command, , can't use " sendkeys.sendwait("^a");" select text.

is there way copy text?

you can uiacomwrapper, need handle window (from trying copy) , information element can uiautomationverify.

var elementcollection = automationelement.fromhandle(windowhandle).findall(treescope.subtree, condition.truecondition); foreach (var item in elementcollection) {    //check item properties if element 1 looking } 

also, instead of condition.truecondition can provide more complex filter 1 element.

edit, added real example:

[dllimport("user32.dll", setlasterror = true)] public static extern intptr findwindow(string lpclassname, string lpwindowname); const string internetexplorerclass = "ieframe"; static void main() {     var windowhandle = new intptr(0);      //find internet explorer instance     windowhandle = findwindow(internetexplorerclass, null);      if (!windowhandle.equals(intptr.zero))     {         //create filter improve search speed         var localizedcontroltype = new propertycondition(             automationelement.localizedcontroltypeproperty,             "tab item");          //get elements in internet explorer match our filter         var elementcollection =             automationelement.fromhandle(windowhandle)                 .findall(treescope.subtree, localizedcontroltype);          //iterate through search results         foreach (automationelement item in elementcollection)         {             console.writeline(item.current.name);         }     }     else     {         console.writeline("internet explorer not found");     }      console.readline(); } 

code above find internet explorer , print tab titles console. put source code github.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -