以下答案仅供参考,有错欢迎留言。
Chapter 4:Direct3D Initialzation
1. Modify the previous exercise solution by disabling the ALT-ENTER functionality to switch between full screen and windowed mode; use the IDXGIFactory::MakeWindowAssociation method and specify the DXGI_MWA_NO_WINDOW_CHANGES flag so that DXGI does not monitor the message queue. Note that the IDXGIFactory::MakeWindowAssociation method needs to be called after IDXGIFactory::CreateSwapChain is called.
意思是禁用框架代码提供的ALT-ENTER键功能,即全屏和窗口模式间的切换。按要求添加代码(注意添加在创建交换链之后):
DXGI应该是利用Hook窗口消息处理过程,监听ALT+ENTER按键,来实现自动的在窗口模式和全屏模式切换。而用DXGI_MWA_NO_WINDOW_CHANGES可以指定取消监听程序消息队列,来"取消"此功能。
为了满足好奇心可以用VS工具菜单下的Spy++来检测ALT-ENTER所发送的窗口消息:
过滤掉所有已知的消息= =,剩下的未知消息应该会包含发送给DXGI的消息吧(我自己的猜测...)
这个窗口正常运行时会一直SendMessage和return一个标识为0x00AE的消息。