locked
SendKeys Usage without selecting windows RRS feed

  • Question

  • Hi everyone. I'm using sendkeys function in my program which has been coded by C#

    What I want to achieve is how I can send keys from my application to another without setting windows link.


    For example,


    int iHandle2 = NativeWin32.FindWindow("Ultima Online", null);
    NativeWin32.SetForegroundWindow(iHandle2);           
    string keys =  asdasdasdasd ;         
    System.Windows.Forms.SendKeys.Send(keys);


    I have no problem with this usage and It does work fine.


    But, the thing that I must do for this usage is choosing windows according the name of application by using FindWindow function.

    I'm just wondering, is there any way which I dont have to choose applications' window and transfering keys directly.

    Sometimes, FindWindow function makes mistake since users all the time changes their windows so as to pass trough windows of another application and at that time,often my program confuses about right place to send keys.

    Thanks in advance.

    H.Burak Demirsoy






    • Edited by Joharez Wednesday, February 8, 2012 1:01 AM addition
    Wednesday, February 8, 2012 1:00 AM

Answers