-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainDlg.h
93 lines (79 loc) · 2.63 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// MainDlg.h : interface of the CMainDlg class
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include "SwndFrame.h"
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 OnBtnSearch();
protected:
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 OnShowWindow(BOOL bShow, UINT nStatus);
BOOL OnInitDialog(HWND wndFocus, LPARAM lInitParam);
BOOL OnEventCaptureHost(EventArgs *pEvt);
BOOL OnEventCaptureHostFinish(EventArgs *pEvt);
BOOL OnEventCaptureSwnd(EventArgs *pEvt);
BOOL OnEventCaptureSwndFinish(EventArgs *pEvt);
BOOL OnEventTreeSelChanged(EventArgs *pEvt);
BOOL OnCopyData(HWND hSend, PCOPYDATASTRUCT pCopyDataStruct);
void EnumSwnd(HWND hHost ,DWORD dwSwnd, HSTREEITEM hItem);
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_HANDLER(L"img_capture_host",EventCapture::EventID,OnEventCaptureHost)
EVENT_NAME_HANDLER(L"img_capture_host",EventCaptureFinish::EventID,OnEventCaptureHostFinish)
EVENT_NAME_HANDLER(L"img_capture_swnd",EventCapture::EventID,OnEventCaptureSwnd)
EVENT_NAME_HANDLER(L"img_capture_swnd",EventCaptureFinish::EventID,OnEventCaptureSwndFinish)
EVENT_NAME_HANDLER(L"tree_swnd",EventTCSelChanged::EventID,OnEventTreeSelChanged)
EVENT_NAME_COMMAND(L"btn_search",OnBtnSearch)
EVENT_MAP_END()
BEGIN_MSG_MAP_EX(CMainDlg)
MSG_WM_INITDIALOG(OnInitDialog)
MSG_WM_CLOSE(OnClose)
MSG_WM_SIZE(OnSize)
MSG_WM_SHOWWINDOW(OnShowWindow)
MSG_WM_COPYDATA(OnCopyData)
CHAIN_MSG_MAP(SHostWnd)
REFLECT_NOTIFICATIONS_EX()
END_MSG_MAP()
private:
BOOL m_bLayoutInited;
STreeCtrl * m_pTreeCtrl;
SwndFrame m_wndFrame;
};