Skip to content

Add "-noborder" launch argument for borderless windowed mode #327

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 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Generals/Code/Main/WinMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
HINSTANCE ApplicationHInstance = NULL; ///< our application instance
HWND ApplicationHWnd = NULL; ///< our application window handle
Bool ApplicationIsWindowed = false;
Bool ApplicationIsBorderless = false; // TheSuperHackers @feature @ShizCalev 04/04/2025 - Borderless Windowed support
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ShizCalev

Win32Mouse *TheWin32Mouse= NULL; ///< for the WndProc() only
DWORD TheMessageTime = 0; ///< For getting the time that a message was posted from Windows.

Expand Down Expand Up @@ -674,7 +675,8 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin
// Create our main window
windowStyle = WS_POPUP|WS_VISIBLE;
if (runWindowed)
windowStyle |= WS_DLGFRAME | WS_CAPTION | WS_SYSMENU;
if(!ApplicationIsBorderless)
windowStyle |= WS_DLGFRAME | WS_CAPTION | WS_SYSMENU;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No WS_SYSMENU when ApplicationIsBorderless ? Fullscreen has WS_SYSMENU.

else
windowStyle |= WS_EX_TOPMOST | WS_SYSMENU;

Expand Down Expand Up @@ -901,6 +903,8 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
//added a preparse step for this flag because it affects window creation style
if (stricmp(token,"-win")==0)
ApplicationIsWindowed=true;
if(stricmp(token,"-noborder")==0)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (
:)

ApplicationIsBorderless=true;
token = nextParam(NULL, "\" ");
}

Expand Down
6 changes: 5 additions & 1 deletion GeneralsMD/Code/Main/WinMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
HINSTANCE ApplicationHInstance = NULL; ///< our application instance
HWND ApplicationHWnd = NULL; ///< our application window handle
Bool ApplicationIsWindowed = false;
Bool ApplicationIsBorderless = false; // TheSuperHackers @feature @ShizCalev 04/04/2025 - Borderless Windowed support
Win32Mouse *TheWin32Mouse= NULL; ///< for the WndProc() only
DWORD TheMessageTime = 0; ///< For getting the time that a message was posted from Windows.

Expand Down Expand Up @@ -696,7 +697,8 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin
// Create our main window
windowStyle = WS_POPUP|WS_VISIBLE;
if (runWindowed)
windowStyle |= WS_DLGFRAME | WS_CAPTION | WS_SYSMENU;
if(!ApplicationIsBorderless)
windowStyle |= WS_DLGFRAME | WS_CAPTION | WS_SYSMENU;
else
windowStyle |= WS_EX_TOPMOST | WS_SYSMENU;

Expand Down Expand Up @@ -926,6 +928,8 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
//added a preparse step for this flag because it affects window creation style
if (stricmp(token,"-win")==0)
ApplicationIsWindowed=true;
if(stricmp(token,"-noborder")==0)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add this in CommandLine.cpp as well, just as a dummy or comment? Reason being that if someone wants to know which options are available, that is the place to look.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a side note: I think it would be neat to implement a logging that prints out all possible arguments when launching it on the command line. In some future change.

ApplicationIsBorderless=true;
token = nextParam(NULL, "\" ");
}

Expand Down
Loading