Thread: C# Embedded Runescape Client Doesn't Take Keyboard Input

Results 1 to 7 of 7
  1. #1 C# Embedded Runescape Client Doesn't Take Keyboard Input 
    Belgium

    Join Date
    Dec 2012
    Posts
    214
    Thanks given
    23
    Thanks received
    21
    Rep Power
    49
    I'm making a runescape toolkit for fun and I wanted to use the exe version of the client.
    Everything works fine until i want to type something for some reason it doesn't register.
    Clicking on buttons within the runescape client works just fine.
    Does anyone have any experience with this?

    All the relevant code:
    Code:
    private void button2_Click(object sender, EventArgs e)
             {
                 startInfo.FileName ="C:/Users/Viktor/jagexcache/jagexlauncher/bin/JagexLauncher.exe";//C:/Users/Viktor/jagexcache/jagexlauncher/bin/JagexLauncher.exe";
                 startInfo.Arguments = "runescape";
                 Process p = Process.Start(startInfo);
                 while(p.MainWindowHandle.ToString().Equals("0") == true){
                     Thread.Sleep(600);
                    SetParent(p.MainWindowHandle, panel1.Handle);
                 }
            }
          [DllImport("user32.dll")]
            static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
    Reply With Quote  
     

  2. #2  
    ???

    funkE's Avatar
    Join Date
    Feb 2008
    Posts
    2,612
    Thanks given
    255
    Thanks received
    989
    Rep Power
    1366
    How is that all the relevant code

    You don't show your code for sending keys.

    Did you try reading the documentation, which includes a working example?

    https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

    Seems like SetForegroundWindow and using SendKeys is the way to go. You may need to find the correct window to focus (which is why you call SetForegroundWindow) to send the keys to the correct element. I don't think you can just send the keys to the window, you need to know the frame?
    .
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Belgium

    Join Date
    Dec 2012
    Posts
    214
    Thanks given
    23
    Thanks received
    21
    Rep Power
    49
    Quote Originally Posted by PlatinumWang View Post
    How is that all the relevant code

    You don't show your code for sending keys.

    Did you try reading the documentation, which includes a working example?

    https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

    Seems like SetForegroundWindow and using SendKeys is the way to go. You may need to find the correct window to focus (which is why you call SetForegroundWindow) to send the keys to the correct element. I don't think you can just send the keys to the window, you need to know the frame?
    That's pretty much all the relevant code I had at that point, all it does was loading the client on the form.
    I was confused that programs like notepad could reconise the keyboard input without anything special but the jagex client doesn't.
    Also thanks for that link it does seem like the way to go, i'm using the c# browser now to load the client, I will try it again in the future with the documentation you've given me thanks.
    Reply With Quote  
     

  5. #4  
    Registered Member
    Join Date
    Aug 2011
    Posts
    67
    Thanks given
    4
    Thanks received
    7
    Rep Power
    0
    Not sure how the jagex exe client works but i think they just put a browser control in a frame. When you send the keys to it, it send it to the panel but the applet doesn't receive it. Thats why you use java because you can directly interact with the applet, send it things, remove its listeners, add listeners, etc.
    Reply With Quote  
     

  6. #5  
    Registered Member
    Project's Avatar
    Join Date
    Dec 2010
    Posts
    2,669
    Thanks given
    1,043
    Thanks received
    820
    Rep Power
    1101
    I know this post is relatively a few weeks old, but I use this as a client to bot with, you could probably just load rs via an applet from rs parameters

    https://github.com/BenLand100/SMART
    Reply With Quote  
     

  7. #6  
    Belgium

    Join Date
    Dec 2012
    Posts
    214
    Thanks given
    23
    Thanks received
    21
    Rep Power
    49
    Quote Originally Posted by Project View Post
    I know this post is relatively a few weeks old, but I use this as a client to bot with, you could probably just load rs via an applet from rs parameters

    https://github.com/BenLand100/SMART
    Yeah it's possible, but it's a big hassle to run/embed a jar in a .net framework.
    In java you can easily run it inside the application because of the jvm, doing it inside .net would require an almost complete translation of the jvm. (if you want to do it the same way as java bots do it)

    So only 2 options remain:
    Run it trough a browser.
    Run/embed the exe that jagex has with runescape in the parameters and send the key events to the client.
    Reply With Quote  
     

  8. #7  
    Registered Member
    Project's Avatar
    Join Date
    Dec 2010
    Posts
    2,669
    Thanks given
    1,043
    Thanks received
    820
    Rep Power
    1101
    Quote Originally Posted by Tigra View Post
    Yeah it's possible, but it's a big hassle to run/embed a jar in a .net framework.
    In java you can easily run it inside the application because of the jvm, doing it inside .net would require an almost complete translation of the jvm. (if you want to do it the same way as java bots do it)

    So only 2 options remain:
    Run it trough a browser.
    Run/embed the exe that jagex has with runescape in the parameters and send the key events to the client.
    Running it through browser would be your best option. Not many people have the installed exe that jagex provides. A lot of people altar it too. Doing so with the browser would (should) provide linux support too
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 28
    Last Post: 02-24-2008, 03:46 AM
  2. All Runescape client people come here
    By tben2004 in forum RS2 Client
    Replies: 7
    Last Post: 09-21-2007, 10:50 PM
  3. The runescape 'Client'
    By Client_Maker in forum RS2 Client
    Replies: 2
    Last Post: 08-22-2007, 06:29 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •