Thiago Souza
Thiago Souza

Reputation: 197

C# - Detect if application has been launched by another program

I've made a Launcher for my game, and the launcher auto-download and patches the game. But, how can I check if the game has been launched by the Launcher? Is there a way to do it without using Command Line Arguments?

Upvotes: 1

Views: 1518

Answers (1)

Astronavigator
Astronavigator

Reputation: 2051

If your launcher is .net application, you can start your application not from command line, but by calling Main() function (from exported class).

If your launcher is not .net application and your application works on Windows only, then you can try to find launcher's window (using FindWindow function) from main application, send message using SendMessage WinApi function, and check result.

These articles might be usefull:

  1. Importing .net classes
  2. Finding windows
  3. Sending messages
  4. Importing dll functions

Upvotes: 2

Related Questions