Postado Março 8, 2011 14 anos Eu tinha esse "tutorial" em um pen drive, então vim postar esse bagulho pra vocês hehehe. Lembrando: Não me perguntem nada, pois não mecho com linguagem vb. Use a lógica! A SendKey ela é uma chamada para simular o teclado. Ela envia um ou mais pressionamentos de teclas para a janela ativa como se tivessem sido digitados no teclado. Codigo da chamada: SendKey "{BACKSPACE}" [/code] Para que o SendKey funcione, será necessário importar: [code] Imports System.Runtime.InteropServices Imports System.Drawing Namespace SimulateKeyPress Code para selecionar a window: SetForegroundWindow(tibia) [/code] Codigos dos caracteres especiais: Citar BACKSPACE - {BACKSPACE}, {BS} ou {BKSP} BREAK - {BREAK} CAPS LOCK - {CAPSLOCK} DEL ou DELETE - {DELETE} ou {DEL} SETA PARA BAIXO - {DOWN} END - {END} ENTER - {ENTER} ou ~ ESC - {ESC} HELP - {HELP} HOME - {HOME} INS ou INSERT - {INSERT} ou {INS} SETA À ESQUERDA - {LEFT} NUM LOCK - {NUMLOCK} PAGE DOWN - {PGDN} PAGE UP - {PGUP} PRINT SCREEN - {PRTSC} SETA À DIREITA - {RIGHT} SCROLL LOCK - {SCROLLLOCK} TAB - {TAB} SETA ACIMA - {UP} F1 - {F1} F2 - {F2} F3 - {F3} F4 - {F4} F5 - {F5} F6 - {F6} F7 - {F7} F8 - {F8} F9 - {F9} F10 - {F10} F11 - {F11} F12 - {F12} F13 - {F13} F14 - {F14} F15 - {F15} F16 - {F16} Exemplo: [spoiler] E aqui vai um exemplo que eu achei no fórum da microsoft. [code] Imports System Imports System.Runtime.InteropServices Imports System.Drawing Imports System.Windows.Forms Namespace SimulateKeyPress Class Form1 Inherits Form Private WithEvents button1 As New Button() <STAThread()> _ Public Shared Sub Main() Application.EnableVisualStyles() Application.Run(New Form1()) End Sub Public Sub New() button1.Location = New Point(10, 10) button1.TabIndex = 0 button1.Text = "Click to automate Calculator" button1.AutoSize = True Me.Controls.Add(button1) End Sub ' Get a handle to an application window. Declare Auto Function FindWindow Lib "USER32.DLL" ( _ ByVal lpClassName As String, _ ByVal lpWindowName As String) As IntPtr ' Activate an application window. Declare Auto Function SetForegroundWindow Lib "USER32.DLL" _ (ByVal hWnd As IntPtr) As Boolean ' Send a series of key presses to the Calculator application. Private Sub button1_Click(ByVal sender As Object, _ ByVal e As EventArgs) Handles button1.Click ' Get a handle to the Calculator application. The window class ' and window name were obtained using the Spy++ tool. Dim calculatorHandle As IntPtr = FindWindow("SciCalc", "Calculator") ' Verify that Calculator is a running process. If calculatorHandle = IntPtr.Zero Then MsgBox("Calculator is not running.") Return End If ' Make Calculator the foreground application and send it ' a set of calculations. SetForegroundWindow(calculatorHandle) SendKeys.SendWait("111") SendKeys.SendWait("*") SendKeys.SendWait("11") SendKeys.SendWait("=") End Sub ' Send a key to the button when the user double-clicks anywhere ' on the form. Private Sub Form1_DoubleClick(ByVal sender As Object, _ ByVal e As EventArgs) Handles Me.DoubleClick ' Send the enter key to the button, which raises the click ' event for the button. This works because the tab stop of ' the button is 0. SendKeys.Send("{ENTER}") End Sub End Class End Namespace É isso, espero ter ajudado, pois hoje em dia todo mundo procura a perfeição do seu bot.
Postado Março 8, 2011 14 anos Muito bom o tópico (tbm n gosto de vb, mais nada contra quem gosta!) Ja tinha utilizado ela com C#, e funfa que é uma belezura # Regras Gerais - TibiaKing.com # Contato: augusto@tibiaking.comNão respondo dúvidas via MP.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.