Results 1 to 2 of 2

Thread: [RESOLVED] Retrieve list of commands

  1. #1

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Resolved [RESOLVED] Retrieve list of commands

    Hi,

    If I have an external game how would I go about retrieving the list of available commands such as setting the amount of ammo, etc?

    I am assuming that I first need to call the game like so

    vb Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.     Private Type STARTUPINFO
    5.       cb As Long
    6.       lpReserved As String
    7.       lpDesktop As String
    8.       lpTitle As String
    9.       dwX As Long
    10.       dwY As Long
    11.       dwXSize As Long
    12.       dwYSize As Long
    13.       dwXCountChars As Long
    14.       dwYCountChars As Long
    15.       dwFillAttribute As Long
    16.       dwFlags As Long
    17.       wShowWindow As Integer
    18.       cbReserved2 As Integer
    19.       lpReserved2 As Long
    20.       hStdInput As Long
    21.       hStdOutput As Long
    22.       hStdError As Long
    23.    End Type
    24.  
    25.    Private Type PROCESS_INFORMATION
    26.       hProcess As Long
    27.       hThread As Long
    28.       dwProcessID As Long
    29.       dwThreadID As Long
    30.    End Type
    31.  
    32.    Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
    33.       hHandle As Long, ByVal dwMilliseconds As Long) As Long
    34.  
    35.    Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
    36.       lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
    37.       lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
    38.       ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
    39.       ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
    40.       lpStartupInfo As STARTUPINFO, lpProcessInformation As _
    41.       PROCESS_INFORMATION) As Long
    42.  
    43.    Private Declare Function CloseHandle Lib "kernel32" _
    44.       (ByVal hObject As Long) As Long
    45.  
    46.    Private Declare Function GetExitCodeProcess Lib "kernel32" _
    47.       (ByVal hProcess As Long, lpExitCode As Long) As Long
    48.  
    49.    Private Const NORMAL_PRIORITY_CLASS = &H20&
    50.    Private Const INFINITE = -1&
    51.  
    52.    Public Function ExecCmd(cmdline$)
    53.       Dim proc As PROCESS_INFORMATION
    54.       Dim start As STARTUPINFO
    55.  
    56.       ' Initialize the STARTUPINFO structure:
    57.       start.cb = Len(start)
    58.  
    59.       ' Start the shelled application:
    60.       ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
    61.          NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
    62.          
    63.       ' Wait for the shelled application to finish:
    64.          ret& = WaitForSingleObject(proc.hProcess, INFINITE)
    65.          Call GetExitCodeProcess(proc.hProcess, ret&)
    66.          Call CloseHandle(proc.hThread)
    67.          Call CloseHandle(proc.hProcess)
    68.          ExecCmd = ret&
    69.           ExecCmd
    70.    End Function
    71.  
    72.    Sub Form_Click()
    73.       Dim retval As Long
    74.       retval = ExecCmd("gta-vc.exe")
    75.       retval
    76.       MsgBox "Process Finished, Exit Code " & retval
    77.    End Sub
    78. End Sub

    instead of

    vb Code:
    1. Dim test
    2.      test = Shell("gta-vc.exe", vbNormalFocus)
    3. With test
    4.  
    5. End With

    Thanks,


    Nightwalker
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  2. #2

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Retrieve list of commands

    I found some source code here which, hopefully shows me what to do.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

Posting Permissions

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



Click Here to Expand Forum to Full Width