Advanced Applet Embedding in .NET

Discussion in 'Programming General' started by hackersrage, Oct 25, 2012.

Advanced Applet Embedding in .NET
  1. Unread #1 - Oct 25, 2012 at 6:11 AM
  2. hackersrage
    Joined:
    Oct 25, 2012
    Posts:
    3
    Referrals:
    0
    Sythe Gold:
    0

    hackersrage Newcomer

    Advanced Applet Embedding in .NET

    I have seen a lot of variations on embedding a web control (or web browser using SetParent), however, I have not seen any examples on how to load a Java applet directly on a .NET form.

    Currently rocking out with VS 2012, as an experienced developer, however I know nothing of Java (except to read it).

    I have toyed with the Java for .NET kit, and really, I am curious about two things:

    1. How can you load/embed an applet directly. (injection ? etc ...)
    2. How can you emulate multiple keyboards/mouse devices. I am not talking about SendKeys or the API equivalent, or even using DirectInput as those all override the primary keyboard, so please don't suggest those unless you have some radical method that breaks the API into multi-touch/multi-keyboard (seperate from main control). As it stands, those API's are all wrapped around a single user input. SendKeys also has a great disadvantage in that it requires focus on the element it is sending to. I am looking to interact with controls regardless of their visibility state.

    I have also found some .NET source for using CEF framework in .NET, however it has some serious issues in VB.NET 2012, not to mention it was written in C# which seems to be missing objects necessary for it to load on the form.

    Any assistance would be greatly appreciated. I know this can be done in .NET, yes have not found any source examples. Java has an abundant amount of examples, but I simply can't work in a coding evironment that requires nearly every function to be in a separate file, and the language is not as verbose as .NET is (nor as fast -- please save the flames on this comment or we can debate it in private).

    Looking forward to intelligent (and hopefully helpful) responses.
     
  3. Unread #2 - Oct 25, 2012 at 10:47 AM
  4. Raid500
    Joined:
    Feb 11, 2007
    Posts:
    592
    Referrals:
    1
    Sythe Gold:
    0

    Raid500 Forum Addict

    Advanced Applet Embedding in .NET

  5. Unread #3 - Oct 25, 2012 at 11:43 AM
  6. Terrankiller
    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    Advanced Applet Embedding in .NET

    Wow, someone actually asks an interesting question for once.

    I'll post an example when I figure it out.
     
  7. Unread #4 - Oct 25, 2012 at 2:59 PM
  8. hackersrage
    Joined:
    Oct 25, 2012
    Posts:
    3
    Referrals:
    0
    Sythe Gold:
    0

    hackersrage Newcomer

    Advanced Applet Embedding in .NET

    This would be fantastic my friend. It is essentially my only barrier. I know with ikvm, you can convert a jar to a .net library if that helps. Perhaps the "loader" could be a JAR canvas with exposed properties of mouse-click, mouse move, keydown, key up, etc (mouse movement x/y would be local to the component rather than other stuff. The main trick with loading the JAR from Runescape for example, is that it asks for encoded data to be passed along with it.

    Just need the bugger accessible in a more direct fashion from inside .NET

    I have some good java sources if needed. (pm for em if u want em)

    That is the Java kit I spoke of in my OP. It doesn't make anything clearer about how to load a live Java Applet from a URL directly into the form. It was a good answer though. I do see this as being potentially the most viable bridge to embedding a custom jar in .NET, however it doesn't appear (or my lack of Java knowledge doesn't permit) to embed an external JAR.
     
  9. Unread #5 - Oct 25, 2012 at 8:20 PM
  10. Raid500
    Joined:
    Feb 11, 2007
    Posts:
    592
    Referrals:
    1
    Sythe Gold:
    0

    Raid500 Forum Addict

    Advanced Applet Embedding in .NET

    Well I know that is what you need, but how to do it, I'm not sure since I've never done it.
     
  11. Unread #6 - Oct 27, 2012 at 1:00 PM
  12. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    Advanced Applet Embedding in .NET

    The reason why Java bots can interact with applets "silently" is because they're not emulating a control (like a keyboard, mouse) but are actually communicating directly with the applet. I assume that once you're able to embed an applet right into a .NET application that you'd be able to do the same thing relatively easily.
     
  13. Unread #7 - Oct 27, 2012 at 1:00 PM
  14. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    Advanced Applet Embedding in .NET

    The reason why Java bots can interact with applets "silently" is because they're not emulating a control (like a keyboard, mouse) but are actually communicating directly with the applet. I assume that once you're able to embed an applet right into a .NET application that you'd be able to do the same thing relatively easily.
     
  15. Unread #8 - Nov 13, 2012 at 12:56 AM
  16. Terrankiller
    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    Advanced Applet Embedding in .NET

    I have some time tomorrow to work on finding a solution for this.
     
  17. Unread #9 - Nov 13, 2012 at 7:29 PM
  18. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    Advanced Applet Embedding in .NET

    Just look at the old ScionBot source, they did it. I plan on using it to figure out a loader if nobody else does lol :p
     
  19. Unread #10 - Nov 13, 2012 at 11:10 PM
  20. Terrankiller
    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    Advanced Applet Embedding in .NET

    Send me the source on MSN, I don't want to start from scratch.
     
  21. Unread #11 - Nov 14, 2012 at 5:05 AM
  22. iJava
    Joined:
    Nov 21, 2011
    Posts:
    1,197
    Referrals:
    11
    Sythe Gold:
    485
    Discord Unique ID:
    220055593568829441

    iJava .Previously known as RSGoldRush
    $200 USD Donor New

    Advanced Applet Embedding in .NET

    Taken from ScionBot :

    Code:
     //Use the Process class in order to load the bot. Redirect the Standard I/O to two streams located
            //in Stub.
            public void Load()
            {
                Process p = new Process();
                p.StartInfo.WorkingDirectory = System.Windows.Forms.Application.StartupPath;
                //We're executing the JVM here.
                p.StartInfo.FileName = Misc.ScionSettings.JavaDirectory + @"\*********";
                //Tell the JVM to run Bot.class with these arguments. Also, tell the JVM to add the runescape.jar
                //into the stack.
                p.StartInfo.Arguments = @"-cp .;loader; Bot " + super.botNumber + " " + super.botAccount.world + " " + DetermineBool(super.botAccount.members) + " " + super.port;
                //This is used to redirect the I/O.
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.RedirectStandardInput = true;
                //p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                p.StartInfo.CreateNoWindow = true;
                //Start the bot.
                p.Start();
                //Push the Standard I/O streams to the botOutput & botInput objects in Stub.cs.
                botProcess = p;
                botBasicOutput = botProcess.StandardOutput;
                botBasicInput = botProcess.StandardInput;
                //Run a loop until the Java-end tells us that the bot's GUI fully intialized.
                while (true)
                {
                    string message = botBasicOutput.ReadLine();
                    if (message.IndexOf("Initialized") > -1)
                        break;
                    //Makes the CPU very low consumption.
                    Thread.Sleep(100);
                }
                while (true)
                {
                    string message = botBasicOutput.ReadLine();
                    if (message.IndexOf("WaitingHandshake") > -1)
                        break;
                    Thread.Sleep(100);
                }
                botSocket = new TcpClient("localhost", super.port);
                botInput = new StreamWriter(botSocket.GetStream());
                botOutput = new StreamReader(botSocket.GetStream());
                while (true)
                {
                    string message = botBasicOutput.ReadLine();
                    if (message.IndexOf("HandshakeAccepted") > -1)
                        break;
                    Thread.Sleep(100);
                }
            }
    Somewhat easy to follow.
     
  23. Unread #12 - Nov 14, 2012 at 6:54 AM
  24. Terrankiller
    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    Advanced Applet Embedding in .NET

    I can do that. Anyone got the runescape.jar file? And all other related files?
     
  25. Unread #13 - Nov 14, 2012 at 11:09 AM
  26. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    Advanced Applet Embedding in .NET

    You'd have to actively download it and check it for updates if I'm right, or else you'll constantly be using an outdated jar
     
  27. Unread #14 - Nov 14, 2012 at 11:37 AM
  28. Terrankiller
    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    Advanced Applet Embedding in .NET

    Oh great. Time to load up Runescape.
     
  29. Unread #15 - Nov 14, 2012 at 4:11 PM
  30. iJava
    Joined:
    Nov 21, 2011
    Posts:
    1,197
    Referrals:
    11
    Sythe Gold:
    485
    Discord Unique ID:
    220055593568829441

    iJava .Previously known as RSGoldRush
    $200 USD Donor New

    Advanced Applet Embedding in .NET

  31. Unread #16 - Nov 15, 2012 at 2:09 AM
  32. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    Advanced Applet Embedding in .NET

  33. Unread #17 - Nov 15, 2012 at 4:33 AM
  34. iJava
    Joined:
    Nov 21, 2011
    Posts:
    1,197
    Referrals:
    11
    Sythe Gold:
    485
    Discord Unique ID:
    220055593568829441

    iJava .Previously known as RSGoldRush
    $200 USD Donor New

    Advanced Applet Embedding in .NET

    You never asked/needed it.
     
< how would i.. | Listen .v2m module music in VB .NET >

Users viewing this thread
1 guest


 
 
Adblock breaks this site