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

Silent Typing Function [Source]

Status
Not open for further replies.

Covey

Creator of EliteSwitch
Joined
Sep 9, 2005
Sythe Gold
9
Messages
4,510
Age
17
Location
Fuckin' BAM!
Silent Typing Function [Source]
Well since im about to move on from VB6 i don't see the point on keeping this too myself. (even though its not that great).

Note
This should only be used with RuneScape, if you try to use this for another program / game. It will not work correctly due to the Universal Charater conversion function.
And to those that want to know what the meaning of "Silent" is, well it simply sends the text to the given handle without actually having to have it as your Desktop Window.

Code:
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Declare Function Putfocus Lib "user32" Alias "SetFocus" (ByVal hWnd As Long) As Long
Private Declare Function GetVersion Lib "kernel32" () As Long
Private Declare Function VkKeyScan Lib "user32" Alias "VkKeyScanA" (ByVal cChar As Byte) As Integer
Private Declare Function VkKeyScanW Lib "user32" (ByVal cChar As Integer) As Integer
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
Private Const WM_CHAR = &H102
Private Const WM_SETFOCUS = &H7
Private Const WM_ACTIVATE = &H6

Private Sub Wait(TimeOut As Long)
    Dim TimeNow As Long
    TimeNow = GetTickCount
    Do
        DoEvents
    Loop While TimeNow + TimeOut > GetTickCount
End Sub

Private Function KeyCode(ByVal sChar As String) As KeyCodeConstants
    Dim bNt As Boolean
    Dim iKeyCode As Integer
    Dim b() As Byte
    Dim iKey As Integer
    Dim vKey As KeyCodeConstants
    Dim iShift As ShiftConstants
    bNt = ((GetVersion() And &H80000000) = 0)
    If (bNt) Then
       b = sChar
       CopyMemory iKey, b(0), 2
       iKeyCode = VkKeyScanW(iKey)
    Else
       b = StrConv(sChar, vbFromUnicode)
       iKeyCode = VkKeyScan(b(0))
    End If
    KeyCode = (iKeyCode And &HFF&)
End Function

Public Sub SendText(wText As String, ByVal wHandle As Long, sTypeSpeed As Long)
    Dim strChr As String
    Dim wCount As Long
    Dim wLen As Long
    wLen = Len(wText)
    Call SendMessage(wHandle, WM_SETFOCUS, True, ByVal 0&)
    Do Until wCount >= wLen
        Randomize
        wCount = wCount + 1
        strChr = Mid$(wText, wCount, 1)
        Call SendMessage(wHandle, WM_KEYDOWN, KeyCode(strChr), ByVal 0&)
        Call SendMessage(wHandle, WM_CHAR, KeyCode(strChr), ByVal 0&)
        Wait Int(Rnd * 3) + 2
        Call SendMessage(wHandle, WM_KEYUP, KeyCode(strChr), ByVal 0&)
        Wait sTypeSpeed
    Loop
    Call SendMessage(wHandle, WM_KEYDOWN, KeyCode(Chr$(13)), ByVal 0&)
    Call SendMessage(wHandle, WM_CHAR, KeyCode(Chr$(13)), ByVal 0&)
    Wait Int(Rnd * 3) + 2
    Call SendMessage(wHandle, WM_KEYUP, KeyCode(Chr$(13)), ByVal 0&)
    Call SendMessage(wHandle, WM_ACTIVATE, True, ByVal 0&)
End Sub

Credits:
Jazz - KeyCode(ByVal sChar As String) Function
Cruel - Wait(TimeOut As Long) Sub
 
Silent Typing Function [Source]
Thanks for giving this to me oh and, what are you moving onto?
 
Silent Typing Function [Source]
Silent Typing Function [Source]
No, he's moving onto .Net 2008.

Thanks for posting Covey, now I can leech it and make a 1337 Auto Typer. :D

haha, yer thats the engine that i've used in the upcoming auto talker in EliteSwitch v2.72.
I'll also be making a silent clicking function for the auto clicker which i will also post when i finish coding it, it will be basically the same but with the WM_Leftclick etc constants.
 
Silent Typing Function [Source]
I don't really get the point of the silent typing covey :) I understand that it keeps focus on the runescape applet which is a good thing, but sendkeys works aswell, also sendkeys DOES work on vista.
 
Silent Typing Function [Source]
I don't really get the point of the silent typing covey :) I understand that it keeps focus on the runescape applet which is a good thing, but sendkeys works aswell, also sendkeys DOES work on vista.

I guess you're missing the point.
You can type in the RuneScape appet while it is minimized or you have another page over the top of it.
 
Silent Typing Function [Source]
I don't really get the point of the silent typing covey :) I understand that it keeps focus on the runescape applet which is a good thing, but sendkeys works aswell, also sendkeys DOES work on vista.

JD he had it already posted it on his first post

Note

And to those that want to know what the meaning of "Silent" is, well it simply sends the text to the given handle without actually having to have it as your Desktop Window.
 
Silent Typing Function [Source]
I understand that you don't have to have focus, but not many uses for it, silent clicking, now that is a different story
 
Silent Typing Function [Source]
I understand that you don't have to have focus, but not many uses for it, silent clicking, now that is a different story

Hmm, yeah...

By the way, cant jagex detect silent clicks? and would they detect the silent typing as well?
 
Silent Typing Function [Source]
Mind showing an example or two on how to use this? Noobs like blupig don't know what a wHandle is for instance. Fucking hWnds and hDCs, I've got no idea what the hell they are :I
 
Silent Typing Function [Source]
Every window has a hWnd (Window Handle) and a hDC (Handle of Device Context). Pretty much hWnd can get where an object is located and can provide some info, but I believe hDC is much more in dept and more powerful (not positive)

But the way to use the function is you use an api to get the window handle you want to type to (FindWindow, FindWindowEx, WindowfromPoint, etc)

I don't feel like explaining how to use the api's, but once you get the object's hwnd you call the function

Code:
SendText "Hello", hWnd, 100
 
Silent Typing Function [Source]
Should tell you guys that, that code is bugged.
If you use it, it will freeze the RuneScape window. You are still able to click on it, but you can't type in the RuneScape window.

You can fix it by removing the last SendMessage line and replacing it with:
Code:
call putfocus(whandle)

Then you need to add the PutFocus API to the declarations.
 
Silent Typing Function [Source]
So if I want to use this, what would I put as the wHandle to look for a .jar based client?
 
Silent Typing Function [Source]
So if I want to use this, what would I put as the wHandle to look for a .jar based client?

This is really only made for RuneScape, so you would need the RuneScape handle, you can get it by using StealRS to switch worlds or by digging up my RuneHwnd code.
 
Silent Typing Function [Source]
How about you paste the silent version with vb.net :D
 
Silent Typing Function [Source]
How about you stop grave digging? O:
 
Status
Not open for further replies.
Runescape Gamblingrunescape gambling
Back
Top