Categories > Coding > C# >

Why does this work? (auto attach)

Posts: 0

Threads: 0

Joined: ?

Reputation:

Posted

I've been using this method to find when roblox is fully opened for a while already.

while (true)
{
    Process[] procs = Process.GetProcessesByName("RobloxPlayerBeta");
    if (procs.Length > 0 && procs[0].MainWindowHandle != IntPtr.Zero) Console.WriteLine("Roblox opened");
    else Console.WriteLine("Roblox not opened");
    Thread.Sleep(1000);
}

Video: https://cdn.discordapp.com/attachments/910497199387967488/921420913092739072/2021-12-17_23-14-25_Trim.mp4

 

My question is, why does this work? Because if the reasons behind this are flimsy and unreliable, then I most likely won't use it anymore (although it has yet to fail me). I could just use Process Watcher but this is much more compact imo. 

 

  • 0

Posts: 94

Threads: 14

Joined: Nov, 2018

Reputation: 8

Replied

@63568 Woah, I never thought this was a thing I would always just check for the number of processes.

  • 0

GitHub: https://github.com/sound-infinity

Discord: SoundInfinity#2135

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )