• Log in or sign up for an account here: https://www.sythe.org/login

Advanced Applet Embedding in .NET

hackersrage

Newcomer
Joined
Oct 25, 2012
Sythe Gold
0
Messages
3
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.
 
Wow, someone actually asks an interesting question for once.

I'll post an example when I figure it out.
 
Wow, someone actually asks an interesting question for once.

I'll post an example when I figure it out.
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)

Take a look at this: http://www.ikvm.net/devguide/net2java.html

That will probably help answer some of your questions.

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.
 
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.

Well I know that is what you need, but how to do it, I'm not sure since I've never done it.
 
Valentine's Singing Competition Winner
Sythe Awards 2015 Winner
Sythe Awards 2016 Winner
Sythe Awards 2020 Winner
Member of the Month Winner
MushyMuncher
Gohan has AIDS
Extreme Homosex
World War 3
I'm LAAAAAAAME
Discord Verified
Off Topic Participant
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.
 
Valentine's Singing Competition Winner
Sythe Awards 2015 Winner
Sythe Awards 2016 Winner
Sythe Awards 2020 Winner
Member of the Month Winner
MushyMuncher
Gohan has AIDS
Extreme Homosex
World War 3
I'm LAAAAAAAME
Discord Verified
Off Topic Participant
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.
 
Valentine's Singing Competition Winner
Sythe Awards 2015 Winner
Sythe Awards 2016 Winner
Sythe Awards 2020 Winner
Member of the Month Winner
MushyMuncher
Gohan has AIDS
Extreme Homosex
World War 3
I'm LAAAAAAAME
Discord Verified
Off Topic Participant
I have some time tomorrow to work on finding a solution for this.

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
 
PHP Shit Show 2k26
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.
 
Valentine's Singing Competition Winner
Sythe Awards 2015 Winner
Sythe Awards 2016 Winner
Sythe Awards 2020 Winner
Member of the Month Winner
MushyMuncher
Gohan has AIDS
Extreme Homosex
World War 3
I'm LAAAAAAAME
Discord Verified
Off Topic Participant
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
 
Runescape Gamblingrunescape gambling
Back
Top