Merge branch 'master' of git.ucc.asn.au:/matches/honours
[matches/honours.git] / research / transmission_spectroscopy / TOF / Win32++ / samples / Dialog / src / MyDialog.cpp
1 ///////////////////////////////////////\r
2 // TofDialog.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 CTofDialog class\r
10 CTofDialog::CTofDialog(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("CTofDialog::CRichView  Failed to load RICHED32.DLL"), _T(""), MB_ICONWARNING);\r
16 }\r
17 \r
18 CTofDialog::~CTofDialog()\r
19 {\r
20         ::FreeLibrary(m_hInstRichEdit);\r
21 }\r
22 \r
23 INT_PTR CTofDialog::DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam)\r
24 {\r
25 //      switch (uMsg)\r
26 //      {\r
27                 //Additional messages to be handled go here\r
28 //      }\r
29 \r
30         // Pass unhandled messages on to parent DialogProc\r
31         return DialogProcDefault(uMsg, wParam, lParam);\r
32 }\r
33 \r
34 BOOL CTofDialog::OnCommand(WPARAM wParam, LPARAM lParam)\r
35 {\r
36         UNREFERENCED_PARAMETER(lParam);\r
37 \r
38         switch (LOWORD(wParam))\r
39     {\r
40         case IDC_BUTTON1:\r
41                 OnButton();\r
42                 return TRUE;\r
43         case IDC_RADIO1:\r
44                 OnRadio1();\r
45                 return TRUE;\r
46         case IDC_RADIO2:\r
47                 OnRadio2();\r
48                 return TRUE;\r
49         case IDC_RADIO3:\r
50                 OnRadio3();\r
51                 return TRUE;\r
52         case IDC_CHECK1:\r
53                 OnCheck1();\r
54                 return TRUE;\r
55         case IDC_CHECK2:\r
56                 OnCheck2();\r
57                 return TRUE;\r
58         case IDC_CHECK3:\r
59                 OnCheck3();\r
60                 return TRUE;\r
61     } //switch (LOWORD(wParam))\r
62 \r
63         return FALSE;\r
64 }\r
65 \r
66 BOOL CTofDialog::OnInitDialog()\r
67 {\r
68         // Set the Icon\r
69         SetIconLarge(IDW_MAIN);\r
70         SetIconSmall(IDW_MAIN);\r
71 \r
72         // Put some text in the edit boxes\r
73         SetDlgItemText(IDC_EDIT1, _T("Edit Control"));\r
74         SetDlgItemText(IDC_RICHEDIT1, _T("Rich Edit Window"));\r
75 \r
76         // Put some text in the list box\r
77         for (int i = 0 ; i < 8 ; i++)\r
78                 SendDlgItemMessage(IDC_LIST1, LB_ADDSTRING, 0, (LPARAM) _T("List Box"));\r
79 \r
80         return true;\r
81 }\r
82 \r
83 void CTofDialog::OnOK()\r
84 {\r
85         MessageBox(_T("OK Button Pressed.  Program will exit now."), _T("Button"), MB_OK);\r
86         CDialog::OnOK();\r
87 }\r
88 \r
89 void CTofDialog::OnButton()\r
90 {\r
91         SetDlgItemText(IDC_STATIC3, _T("Button Pressed"));\r
92         TRACE(_T("Button Pressed\n"));\r
93 }\r
94 \r
95 void CTofDialog::OnCheck1()\r
96 {\r
97         SetDlgItemText(IDC_STATIC3, _T("Check Box 1"));\r
98         TRACE(_T("Check Box 1\n"));\r
99 }\r
100 \r
101 void CTofDialog::OnCheck2()\r
102 {\r
103         SetDlgItemText(IDC_STATIC3, _T("Check Box 2"));\r
104         TRACE(_T("Check Box 2\n"));\r
105 }\r
106 \r
107 void CTofDialog::OnCheck3()\r
108 {\r
109         SetDlgItemText(IDC_STATIC3, _T("Check Box 3"));\r
110         TRACE(_T("Check Box 3\n"));\r
111 }\r
112 \r
113 void CTofDialog::OnRadio1()\r
114 {\r
115         SetDlgItemText(IDC_STATIC3, _T("Radio 1"));\r
116         TRACE(_T("Radio 1\n"));\r
117 }\r
118 \r
119 void CTofDialog::OnRadio2()\r
120 {\r
121         SetDlgItemText(IDC_STATIC3, _T("Radio 2"));\r
122         TRACE(_T("Radio 2\n"));\r
123 }\r
124 \r
125 void CTofDialog::OnRadio3()\r
126 {\r
127         SetDlgItemText(IDC_STATIC3, _T("Radio 3"));\r
128         TRACE(_T("Radio 3\n"));\r
129 }\r
130 \r

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