Advertisement

IDXGIFactory::MakeWindowAssociation has no effect

Started by July 19, 2017 07:25 AM
4 comments, last by MarcusAseth 7 years, 4 months ago

bool InitDirect3D::Init()
{
	if (!D3DApp::Init())
	{
		return false;
	}

	//Additional Initialization

	//Disable Alt+Enter Fullscreen Toggle shortkey
	IDXGIFactory* factory;
	CreateDXGIFactory(__uuidof(IDXGIFactory), reinterpret_cast<void**>(&factory));
	factory->MakeWindowAssociation(mhWindow, DXGI_MWA_NO_WINDOW_CHANGES);
	factory->Release();

	return true;
}

 

As stated on the title and displayed on the code above, regardless of it Alt+Enter still takes effect...

I recall something from the book during the swapChain creation, where in order to create it one has to use the same factory used to create the ID3D11Device, therefore I tested and indeed using that same factory indeed it work.

How is that one particular factory related to my window and how come the MakeWindowAssociation won't take effect with a newly created factory?

Also what's even the point of being able to create this Factories if they won't work,?(except from that one associated with the ID3D11Device) :/

Do you check the function return value?

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/
Advertisement
5 hours ago, Alessio1989 said:

Do you check the function return value?

Just did, returned S_OK so no error there.

Edit: I checked the factory creation, let me check the function below it as well

Thas is S_OK too, no errors.

I believe you are looking for the DXGI_MWA_NO_ALT_ENTER flag.

No the flag is correct, it stops ALT+Enter  if the function is called with the same factory used to create the Device, I tested it.

Is stated in the msdn as well, 

Quote

Applications that want to handle mode changes or Alt+Enter themselves should call MakeWindowAssociation with the DXGI_MWA_NO_WINDOW_CHANGES flag after swap chain creation.

Calling MakeWindowAssociation with the DXGI_MWA_NO_WINDOW_CHANGES flag after swapchain creation ensures that DXGI will not interfere with application's handling of window mode changes or Alt+Enter.

Basically is more generic than the Alt Enter flag from what I can tell

This topic is closed to new replies.

Advertisement