4 #include "resource.h"
\r
6 CMainDlg::CMainDlg(void)
\r
10 CMainDlg::~CMainDlg(void)
\r
14 LRESULT CMainDlg::DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
\r
20 InitDialog(hwndDlg, IDR_MAINFRAME);
\r
22 // Set title using app name
\r
24 ::SetWindowText(*this, CUtility::getAppName().c_str());
\r
25 // Hide 'Send' button if required. Position 'Send' and 'Save'.
\r
27 HWND okButton = ::GetDlgItem(*this, IDOK);
\r
28 HWND saveButton = ::GetDlgItem(*this, IDC_SAVE);
\r
31 // Line up Save, Send [OK] and Exit [Cancel] all in a row
\r
32 HWND cancelButton = ::GetDlgItem(*this, IDCANCEL);
\r
33 WINDOWPLACEMENT okPlace;
\r
34 WINDOWPLACEMENT savePlace;
\r
35 WINDOWPLACEMENT cancelPlace;
\r
37 ::GetWindowPlacement(okButton, &okPlace);
\r
38 ::GetWindowPlacement(saveButton, &savePlace);
\r
39 ::GetWindowPlacement(cancelButton, &cancelPlace);
\r
41 savePlace.rcNormalPosition.left =
\r
42 okPlace.rcNormalPosition.left -
\r
43 (savePlace.rcNormalPosition.right - savePlace.rcNormalPosition.left) +
\r
44 (okPlace.rcNormalPosition.right - cancelPlace.rcNormalPosition.left);
\r
45 ::SetWindowPlacement(saveButton, &savePlace);
\r
47 DWORD style = ::GetWindowLong(okButton, GWL_STYLE);
\r
48 ::SetWindowLong(okButton, GWL_STYLE, style | WS_VISIBLE);
\r
52 WINDOWPLACEMENT okPlace;
\r
54 // Put Save on top of the invisible Send [OK]
\r
55 ::GetWindowPlacement(okButton, &okPlace);
\r
57 ::SetWindowPlacement(saveButton, &okPlace);
\r
59 DWORD style = ::GetWindowLong(okButton, GWL_STYLE);
\r
60 ::SetWindowLong(okButton, GWL_STYLE, style & ~ WS_VISIBLE);
\r
65 return DoCommand(LOWORD(wParam));
\r
72 LRESULT CMainDlg::DoCommand(int id)
\r
78 HWND hWndEmail = ::GetDlgItem(*this, IDC_EMAIL);
\r
79 HWND hWndDesc = ::GetDlgItem(*this, IDC_DESCRIPTION);
\r
80 int nEmailLen = ::GetWindowTextLength(hWndEmail) + 1;
\r
81 int nDescLen = ::GetWindowTextLength(hWndDesc) + 1;
\r
83 TCHAR * lpStr = new TCHAR[nEmailLen+1];
\r
84 ::GetWindowText(hWndEmail, lpStr, nEmailLen);
\r
88 lpStr = new TCHAR[nDescLen+1];
\r
89 ::GetWindowText(hWndDesc, lpStr, nDescLen);
\r
90 m_sDescription = lpStr;
\r
93 EndDialog(*this, IDOK);
\r
97 EndDialog(*this, IDC_SAVE);
\r
101 EndDialog(*this, IDCANCEL);
\r
102 PostQuitMessage(IDCANCEL);
\r