Commit before breaking everything
[matches/honours.git] / research / transmission_spectroscopy / TOF / Win32++ / samples / DLL / src / MyDialog.cpp
1 ///////////////////////////////////////\r
2 // MyDialog.cpp\r
3 \r
4 #include "stdafx.h"\r
5 #include "MyDialog.h"\r
6 #include "resource.h"\r
7 \r
8 \r
9 // Definitions for the CMyDialog class\r
10 CMyDialog::CMyDialog(UINT nResID, CWnd* pParent)\r
11         : CDialog(nResID, pParent)\r
12 {\r
13         m_hInstRichEdit = ::LoadLibrary(_T("RICHED32.DLL"));\r
14     if (!m_hInstRichEdit)\r
15                 ::MessageBox(NULL, _T("CMyDialog::CRichView  Failed to load RICHED32.DLL"), _T(""), MB_ICONWARNING);\r
16 }\r
17 \r
18 CMyDialog::~CMyDialog()\r
19 {\r
20         ::FreeLibrary(m_hInstRichEdit);\r
21 }\r
22 \r
23 INT_PTR CMyDialog::DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam)\r
24 {\r
25         switch (uMsg)\r
26         {\r
27         case WM_DESTROY:\r
28                 TRACE(_T("Dialog inside DLL destroyed\n"));\r
29                 ::PostQuitMessage(0);\r
30                 break;\r
31         }\r
32 \r
33         // Pass unhandled messages on to parent DialogProc\r
34         return DialogProcDefault(uMsg, wParam, lParam);\r
35 }\r
36 \r
37 BOOL CMyDialog::OnCommand(WPARAM wParam, LPARAM lParam)\r
38 {\r
39         UNREFERENCED_PARAMETER(lParam);\r
40 \r
41         switch (LOWORD(wParam))\r
42     {\r
43         case IDC_BUTTON1:\r
44                 OnButton();\r
45                 return TRUE;\r
46         case IDC_RADIO1:\r
47                 OnRadio1();\r
48                 return TRUE;\r
49         case IDC_RADIO2:\r
50                 OnRadio2();\r
51                 return TRUE;\r
52         case IDC_RADIO3:\r
53                 OnRadio3();\r
54                 return TRUE;\r
55         case IDC_CHECK1:\r
56                 OnCheck1();\r
57                 return TRUE;\r
58         case IDC_CHECK2:\r
59                 OnCheck2();\r
60                 return TRUE;\r
61         case IDC_CHECK3:\r
62                 OnCheck3();\r
63                 return TRUE;\r
64     } //switch (LOWORD(wParam))\r
65 \r
66         return FALSE;\r
67 }\r
68 \r
69 BOOL CMyDialog::OnInitDialog()\r
70 {\r
71         // Set the Icon\r
72         SetIconLarge(IDI_DIALOG);\r
73         SetIconSmall(IDI_DIALOG);\r
74 \r
75         // Put some text in the edit boxes\r
76         SetDlgItemText(IDC_EDIT1, _T("Edit Control"));\r
77         SetDlgItemText(IDC_RICHEDIT1, _T("Rich Edit Window"));\r
78 \r
79         // Put some text in the list box\r
80         for (int i = 0 ; i < 8 ; i++)\r
81                 SendDlgItemMessage(IDC_LIST1, LB_ADDSTRING, 0, (LPARAM) _T("List Box"));\r
82 \r
83         return true;\r
84 }\r
85 \r
86 void CMyDialog::OnOK()\r
87 {\r
88         ::MessageBox(NULL, _T("OK Button Pressed.  Dialog will now end."), _T("Button"), MB_OK);\r
89         CDialog::OnOK();\r
90 }\r
91 \r
92 void CMyDialog::OnButton()\r
93 {\r
94         SetDlgItemText(IDC_STATIC3, _T("Button Pressed"));\r
95         TRACE(_T("Button Pressed\n"));\r
96 }\r
97 \r
98 void CMyDialog::OnCheck1()\r
99 {\r
100         SetDlgItemText(IDC_STATIC3, _T("Check Box 1"));\r
101         TRACE(_T("Check Box 1\n"));\r
102 }\r
103 \r
104 void CMyDialog::OnCheck2()\r
105 {\r
106         SetDlgItemText(IDC_STATIC3, _T("Check Box 2"));\r
107         TRACE(_T("Check Box 2\n"));\r
108 }\r
109 \r
110 void CMyDialog::OnCheck3()\r
111 {\r
112         SetDlgItemText(IDC_STATIC3, _T("Check Box 3"));\r
113         TRACE(_T("Check Box 3\n"));\r
114 }\r
115 \r
116 void CMyDialog::OnRadio1()\r
117 {\r
118         SetDlgItemText(IDC_STATIC3, _T("Radio 1"));\r
119         TRACE(_T("Radio 1\n"));\r
120 }\r
121 \r
122 void CMyDialog::OnRadio2()\r
123 {\r
124         SetDlgItemText(IDC_STATIC3, _T("Radio 2"));\r
125         TRACE(_T("Radio 2\n"));\r
126 }\r
127 \r
128 void CMyDialog::OnRadio3()\r
129 {\r
130         SetDlgItemText(IDC_STATIC3, _T("Radio 3"));\r
131         TRACE(_T("Radio 3\n"));\r
132 }\r
133 \r

UCC git Repository :: git.ucc.asn.au