Skip to content

[ZH] Make game start on the monitor that it is launched from #543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

helmutbuhler
Copy link

This PR fixes the window creation to open on the monitor the game is launched on.
This way, when the executable or a shortcut to it is opened on a certain monitor, the window opens on the same monitor. This also works when the game is started from the taskbar.
The code to do this may seem hacky, but it's exactly what the documentation for GetStartupInfo recommends.

Also note that I needed to #define WINVER 0x0500, because the Monitor API didn't exist in Win 95 yet. This causes the compiler to emit a message when compiling WinMain.cpp, but generates no error or warning. The game will also no longer run on Win95, but I think we can live with that.

Change list

  • fix: The game starts now on the monitor it's launched from

@DevGeniusCode
Copy link

Is this to solve a specific problem? What about those who would like the game to open on a different monitor or where it was last opened?

@DevGeniusCode DevGeniusCode added Enhancement Is new feature or request Minor Severity: Minor < Major < Critical < Blocker ZeroHour Relates to Zero Hour labels Mar 29, 2025
roossienb pushed a commit to roossienb/GeneralsGameCode that referenced this pull request Mar 29, 2025
roossienb pushed a commit to roossienb/GeneralsGameCode that referenced this pull request Mar 29, 2025
@helmutbuhler
Copy link
Author

Well, right now it always starts up on the primary monitor, and I figured people prefer to have it launch where they start it.
We can also add commandline arguments to specify the position/monitor where the game should launch, but probably in another PR.
And maybe we can also try to remember the last position, but that tends to be not so reliable in case monitor configurations change between runs.

@tintinhamans
Copy link

Ideally this becomes a setting in display options which you can choose in-game.

See Call of Duty implementation:

image

@helmutbuhler
Copy link
Author

Yes, that would be ideal.
But it's also quite a bit of work to implement that. And even when we have that implemented, we'd still need to decide on a monitor on first startup, so I don't think we should block this PR until we have all that implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Is new feature or request Minor Severity: Minor < Major < Critical < Blocker ZeroHour Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants