Jump to content

While...WEnd Loop


Recommended Posts

Alright, I'm running a loop to check if a game is running, as the While loops, but it is using a lot my CPU (>45%). I was thinking maybe something that would check the current status to see if it is running, then based on that, check to see if it's running or not, and if its the same as the current status, just skip it. I've been trying to think of something to do that but i can't come up with anything.. Any ideas?

While 1
    $nMsg = GUIGetMsg()
    $iv_Pid = ProcessExists("game.exe")
    If $iv_Pid = 0 Then
        GUICtrlSetData($Label5, "The game is not running")
        GUICtrlSetColor(-1, 0xFF0000)
    Else
        $ah_Handle = _MemoryOpen($iv_Pid)
        If Not @error Then
            GUICtrlSetData($Label5, "The game is running")
            GUICtrlSetColor(-1, 0x008000)
        EndIf
    EndIf
; ...
    EndSwitch
WEnd
Edited by zeffy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...