My RS Loader

Discussion in 'Programming General' started by Terrankiller, Sep 29, 2011.

My RS Loader
  1. Unread #1 - Sep 29, 2011 at 6:17 AM
  2. Terrankiller
    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    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

    [​IMG]
     
  3. Unread #2 - Sep 29, 2011 at 6:18 AM
  4. Deathsnova
    Joined:
    Jan 5, 2008
    Posts:
    1,654
    Referrals:
    144
    Sythe Gold:
    11

    Deathsnova Can we take it back to the time when I wasn't aware.
    Competition Winner $50 USD Donor New Trade With Caution

    My RS Loader

    Wow amazing, great job working on it!
    It loads RS perfectly for me!
    Thanks again!
     
  5. Unread #3 - Oct 1, 2011 at 11:57 AM
  6. Terrankiller
    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    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
    
    
     
< AutoTyper.Net: Source | Java Problem/Puzzle >

Users viewing this thread
1 guest


 
 
Adblock breaks this site