Sign in to follow this  
Letters90

Borderless Windowed Mode configuration

Recommended Posts

Hello!

 

I'm trying to mod a rather old game to enable it to run in windowed mode, specifically borderless window mode. Can you guys help me with the step of configuring direct x and the windows api window settings? I would be truly grateful. 

 

Regard Letters.

Share this post


Link to post
Share on other sites

I can only speak for d3d9 (for now);

 

- make sure you set the windowed flag in the d3d parameters to true

- after creating the window, use ShowWindow and UpdateWindow (to present the window)

- in the windowclass make sure the used style (for creating the window, i.e. CreateWindowEx) has the flag "WS_POP"

	mWc.style			= CS_HREDRAW | CS_VREDRAW;
	mWc.lpfnWndProc		= (WNDPROC)pWindowProc;
	mWc.cbClsExtra		= 0;
	mWc.cbWndExtra		= 0;
	mWc.hInstance		= pHinstance;
	mWc.hIcon			= LoadIcon(0, IDI_APPLICATION);
	mWc.hCursor			= LoadCursor(0, IDC_ARROW);
	mWc.lpszMenuName	= 0;
	mWc.lpszClassName	= L"WindowClass";
	mWc.cbSize			= sizeof(WNDCLASSEX);
	
	ShowCursor(FALSE);
	style = WS_POPUP;									// borderless window (no difference fullscreen/windowed, no borders / rect issues

	if(0 == (RegisterClassEx(&mWc))) return false;

	if(NULL == (mHwnd = CreateWindowEx(NULL,L"WindowClass", L"Crealysm", style,
							 		 0, 0, mSettings.GetScreenWidth(), mSettings.GetScreenHeight(),
									 NULL, NULL, pHinstance, NULL))) return false;
	if(mSettings.GetWindowed())
	{
		ShowWindow(mHwnd, pNcmdShow);
		UpdateWindow(mHwnd);
	}

// another snippet

	if(!mSettings.GetWindowed()) 
	{
		mD3dpp.BackBufferFormat = mAdapterFormat;
		mD3dpp.Windowed = false;
		mD3dpp.BackBufferWidth = mSettings.GetScreenWidth();
		mD3dpp.BackBufferHeight = mSettings.GetScreenHeight();
		mD3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
	}
	else mD3dpp.Windowed = true;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this