forked from soui-demo/360
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainDlg.h
78 lines (69 loc) · 2.01 KB
/
MainDlg.h
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// MainDlg.h : interface of the CMainDlg class
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
class CMainDlg : public SHostWnd
{
public:
CMainDlg();
~CMainDlg();
void OnClose()
{
//AnimateHostWindow(200,AW_CENTER|AW_HIDE);
DestroyWindow();
}
void OnMaximize()
{
SendMessage(WM_SYSCOMMAND,SC_MAXIMIZE);
}
void OnRestore()
{
SendMessage(WM_SYSCOMMAND,SC_RESTORE);
}
void OnMinimize()
{
SendMessage(WM_SYSCOMMAND,SC_MINIMIZE);
}
void OnSize(UINT nType, CSize size)
{
SetMsgHandled(FALSE);
if(!m_bLayoutInited) return;
if(nType==SIZE_MAXIMIZED)
{
FindChildByName(L"btn_restore")->SetVisible(TRUE);
FindChildByName(L"btn_max")->SetVisible(FALSE);
}else if(nType==SIZE_RESTORED)
{
FindChildByName(L"btn_restore")->SetVisible(FALSE);
FindChildByName(L"btn_max")->SetVisible(TRUE);
}
}
void OnBtnMsgBox()
{
SMessageBox(NULL,_T("this is a message box"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
SMessageBox(NULL,_T("this message box includes two buttons"),_T("haha"),MB_YESNO|MB_ICONQUESTION);
SMessageBox(NULL,_T("this message box includes three buttons"),NULL,MB_ABORTRETRYIGNORE);
}
int OnCreate(LPCREATESTRUCT lpCreateStruct);
void OnShowWindow(BOOL bShow, UINT nStatus);
BOOL OnInitDialog(HWND wndFocus, LPARAM lInitParam);
protected:
EVENT_MAP_BEGIN()
EVENT_NAME_COMMAND(L"btn_close",OnClose)
EVENT_NAME_COMMAND(L"btn_min",OnMinimize)
EVENT_NAME_COMMAND(L"btn_max",OnMaximize)
EVENT_NAME_COMMAND(L"btn_restore",OnRestore)
EVENT_NAME_COMMAND(L"btn_msgbox",OnBtnMsgBox)
EVENT_MAP_END()
BEGIN_MSG_MAP_EX(CMainDlg)
MSG_WM_CREATE(OnCreate)
MSG_WM_INITDIALOG(OnInitDialog)
MSG_WM_CLOSE(OnClose)
MSG_WM_SIZE(OnSize)
MSG_WM_SHOWWINDOW(OnShowWindow)
CHAIN_MSG_MAP(SHostWnd)
REFLECT_NOTIFICATIONS_EX()
END_MSG_MAP()
private:
BOOL m_bLayoutInited;
};