- Home /
How can I change the window title of my game during runtime? (multiple applications running).
Hello!
I have a very experimental game I am building wherein the User will have 4 instances of the game running simultaneously. When I launch the instances of the game through the commandline, each instance is named "MyGame".
What I would like to be able to do is change each instance's window title name to be something like "Game01" "Game02" "Game03" and "Game04".
I can change the window name using the user32.dll "SetWindowText", but I am having trouble finding the window, because each window is named "MyGame" so user32.dll "FindWindow" seems to grab the first random one it finds. GetForegroundWindow doesn't seem to help either as I am launching all applications at once, so again, Im not sure which window I am getting first.
Any thoughts?
Answer by V0odo0 · Apr 06, 2021 at 09:18 PM
Since you are launching your app trough command line, you can parse Environment.CommandLine from inside each instance and change it's name according to the passed arguments.
I would like to do that, but the problem I am having is being able to change it's name, because I can't find a handle to the specific window instance if they all share the same name.