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

My RS Loader

Terrankiller

Ex-Administrator
Joined
May 7, 2005
Sythe Gold
1
Messages
1,286
Location
California
My RS Loader
This is my RS Loader for all of you client and bot developers out there. I have included an example on how to use the function. This is an improved version of the "Get RS Applet Handle" example located here: (http://sythe.org/showthread.php?t=1242029). Instead of being lazy and using a loop we use API to enumerate the child window handles into an array. We then get the class names of the window handles to identify which handle in the array is the RS applet. You all can thank me later ;).

Oh and btw, post 1000.

http://siegetank.net/downloads/sources/RSLoader.zip

rsloader2.png
 
My RS Loader
Some people have asked questions about why the scale is off when they load the RS Applet. I did that for my client as an example. Here is how you should implement it if you don't want scale issues:

Loader Module:

Code:
    Public Function GetRS(ByVal WB As WebBrowser) As IntPtr

        Dim sClass As New System.Text.StringBuilder("", 256)

        Dim WndList() As IntPtr = GetChildWindows(WB.Handle)

        For i = 0 To UBound(WndList)

            GetClassName(WndList(i), sClass, 256)

            If sClass.ToString = "SunAwtFrame" Then

                'Found the RS Applet
                Return WndList(i)
                Exit Function

            End If

        Next

        Return -1

    End Function

Form Code:

Code:
    Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim rWND As System.Drawing.Rectangle
        Dim wb As New WebBrowser

        Controls.Add(wb)
        wb.Navigate("http://www.runescape.com/game.ws?j=1")

        Do Until wb.ReadyState = 4

            Application.DoEvents()

        Loop

        RSApplet = GetRS(wb)

        If RSApplet = -1 Then

            MsgBox("Could not load RS, you fail")

        Else

            RSlist = GetChildWindows(RSApplet)
            GetWindowRect(RSApplet, rWND)
            SetParent(RSApplet, Me.Handle)
            MoveWindow(RSApplet, 0, 0, rWND.Width, rWND.Height, True)

        End If

        Controls.Remove(wb)

    End Sub
 
Runescape Gamblingrunescape gambling
Back
Top