1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#include <string>
#include "EditorWindows.h"
#include "WinUtils.h"
#include "Editor/Utils/HelperFuncs.h"
#include "MenuManager.h"
#include "Runtime/Utilities/Assert.h"
bool ProcessMainWindowMessages(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT& result)
{
//if(message!=WM_TIMER && message!=WM_SETCURSOR)
// printf_console("msg: %s\n", winutils::GetWindowsMessageInfo(message,wParam,lParam).c_str());
switch (message)
{
// Ok, this is fun: when we're using swap chains and no "regular window", often we don't get device loss events, even though it
// looks like the device is put into "lost" state. So whenever anything important changes (resolution, user logs in, etc.),
// try to manually reset the device and repaint everything. Yay!
case WM_SETTINGCHANGE:
// when switching to screen saver, it seems that the only way to detect that is by handling working area change message.
if (wParam == SPI_SETWORKAREA) {
}
break;
case WM_DISPLAYCHANGE:
case WM_DEVMODECHANGE:
case WM_USERCHANGED:
break;
case WM_COPYDATA:
{
}
break;
case WM_INITMENU: // 主窗口菜单栏初始化
return true;
case WM_COMMAND: // 点击菜单,点击加速键,点击子窗口按钮,点击工具栏按钮。这些时候都有command消息产生。
break;
case WM_ACTIVATEAPP:
break;
case WM_DESTROY:
::PostQuitMessage(0);
break;
}
return false;
}
|