Results 1 to 4 of 4
  1. #1

    [NEED]Help Please!

    I tried myself to input the command rate 25000 to ET console
    I used this code:
    Code:
    Imports System.Diagnostics
    Imports System.Threading
    Imports System.Runtime.InteropServices
    Imports System.IO
    Public Class Form1
        Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
        Public Shared Function SetForegroundWindow(ByVal hwnd As IntPtr) As Boolean
        End Function
        Private Sub SendCommandtoConsole(ByVal Command As String)
            Dim etHandle As Long = FindWindow(Nothing, "ET Console")
            If etHandle = Nothing Then
                MessageBox.Show("ET is not running.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Else
                SetForeGroundWindow(etHandle)
                SendKeys.SendWait(String.Concat(Command, "~"))
            End If
        End Sub
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            SendCommandtoConsole("rate 26000")
        End Sub
    End Class
    and I need help because nothing worked
    Learn:
    Visual Basic 2006/8
    Visual C++

  2. #2

    Post Re: [NEED]Help Please!

    First of all, im not extremely good at vb, although I can understand it well, so whatever I say here, correct me if im wrong

    Code:
    Dim etHandle As Long = FindWindow(Nothing, "ET Console")
    ET console, I believe, disappears when actually in game. So I think you will have to use the main window name for ET when the game is running whereas you'd need to manually open the console from there. Unless of course your trying to run a dedicated server and you always have ET console open then I doubt this source will work. Why?

    This

    Code:
    Private Sub SendCommandtoConsole(ByVal Command As String)
    And this

    Code:
    SendCommandtoConsole("rate 26000")
    Could prove faulty, because the SendCommandtoConsole function contains no keysending, therefore I think using this sub
    would not work. Also i did see that you used sendkeys.sendwait. In my opinion I think you can make a much simpler program

    Eg,

    Code:
    SetForegroundWindow(etHandle) << activates the et window
    Threading.Thread.Sleep(100)  << so that nothing goes too fast 
    Sendkeys.Send("rate 25000{ENTER}")  << enters the command you wish to execute in the ET console
    Try creating it that way if you believe it will help you


    I hope this helps
    ________________________________________________

  3. #3
    Senior Member uNhoL's Avatar
    Join Date
    Dec 2007
    Posts
    393

    Re: [NEED]Help Please!

    Quote Originally Posted by obsidian View Post
    First of all, im not extremely good at vb, although I can understand it well, so whatever I say here, correct me if im wrong

    Code:
    Dim etHandle As Long = FindWindow(Nothing, "ET Console")
    ET console, I believe, disappears when actually in game. So I think you will have to use the main window name for ET when the game is running whereas you'd need to manually open the console from there. Unless of course your trying to run a dedicated server and you always have ET console open then I doubt this source will work. Why?

    This

    Code:
    Private Sub SendCommandtoConsole(ByVal Command As String)
    And this

    Code:
    SendCommandtoConsole("rate 26000")
    Could prove faulty, because the SendCommandtoConsole function contains no keysending, therefore I think using this sub
    would not work. Also i did see that you used sendkeys.sendwait. In my opinion I think you can make a much simpler program

    Eg,

    Code:
    SetForegroundWindow(etHandle) << activates the et window
    Threading.Thread.Sleep(100)  << so that nothing goes too fast 
    Sendkeys.Send("rate 25000{ENTER}")  << enters the command you wish to execute in the ET console
    Try creating it that way if you believe it will help you


    I hope this helps
    I've been coding with VB too, but i tried your way, it didn't work for some reason AND my mouse stops moving because u forgot to add focus into ur program again ;D. i'm gonna try to find out a good way to do it and i'll tell you guys if i can figure out something


    MOOOOM MY INTERNET IS TOO SLOW

  4. #4

    Re: [NEED]Help Please!

    @obsidian I tried what you said and it didn't work but still thanks
    @uNhoL Ok thanks
    Learn:
    Visual Basic 2006/8
    Visual C++

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •