Jump to content

[Help] Opening a game

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic

#1
ScreWe

ScreWe

    Newbie

  • Members
  • PipPip
  • 10 posts
Heres the code i have for this. What it does is you press a key and it will close Halo as a process instantly... or press another button which will close the process and reopen it. My problem is it will only run if it is placed in the halo folder.

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 100
End Sub

Private Sub Timer1_Timer()

If GetAsyncKeyState(vbKeyEnd) Then
Text1.Text = ("Halo is Closing.")
TerminerProcessus ("Halo.exe")
Else
End If

If GetAsyncKeyState(vbKeyHome) Then
Text1.Text = ("Halo is now Restarting.")
TerminerProcessus ("Halo.exe")
Shell "C:\Program Files\Microsoft Games\Halo\halo.exe", vbNormalFocus
Else
End If
End Sub

Heres the error message i get when it is NOT in my halo folder.
Posted Image

I have a module in it to which allows me to hotkey.. so tell me if you need that

#2
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
I think that is happening because you are not closing halo properly.. but you are like 'crashing' the process.

#3
ScreWe

ScreWe

    Newbie

  • Members
  • PipPip
  • 10 posts
Well it closes fine and all but now that you said what you did.. maybe i need to set a delay between the end process and opening process.. but ya any more suggestions.

#4
xor

xor

    Newbie

  • Members
  • Pip
  • 9 posts
That error is telling you whats wrong it can't find the config.txt is the config.txt in the Halo folder?

Seems you are missing a file.... theres nothing wrong with the code about a file is missing.:cool:

#5
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Yeah, but if he has a file missing I would assume that, that error will happen whenever he closes the game (even when closed properly?)

#6
ScreWe

ScreWe

    Newbie

  • Members
  • PipPip
  • 10 posts
the file is in the folder..

And i have no problem closing it.. its when i open it :/

#7
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Did you make the delay? Did it crash again?

#8
ScreWe

ScreWe

    Newbie

  • Members
  • PipPip
  • 10 posts
havent tested it