00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00049 #ifndef ATLSTL_INCL_ATLSTL_WINDOW_HPP_ABOUT_DIALOG
00050 #define ATLSTL_INCL_ATLSTL_WINDOW_HPP_ABOUT_DIALOG
00051
00052 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00053 # define ATLSTL_VER_ATLSTL_WINDOW_HPP_ABOUT_DIALOG_MAJOR 4
00054 # define ATLSTL_VER_ATLSTL_WINDOW_HPP_ABOUT_DIALOG_MINOR 0
00055 # define ATLSTL_VER_ATLSTL_WINDOW_HPP_ABOUT_DIALOG_REVISION 3
00056 # define ATLSTL_VER_ATLSTL_WINDOW_HPP_ABOUT_DIALOG_EDIT 53
00057 #endif
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 #ifndef ATLSTL_INCL_ATLSTL_HPP_ATLSTL
00074 # include <atlstl/atlstl.hpp>
00075 #endif
00076 #ifndef STLSOFT_INCL_STLSOFT_MEMORY_HPP_AUTO_BUFFER
00077 # include <stlsoft/memory/auto_buffer.hpp>
00078 #endif
00079 #ifndef STLSOFT_INCL_STLSOFT_MEMORY_HPP_MALLOC_ALLOCATOR
00080 # include <stlsoft/memory/malloc_allocator.hpp>
00081 #endif
00082
00083 #ifndef STLSOFT_INCL_SYS_H_ATLWIN
00084 # define STLSOFT_INCL_SYS_H_ATLWIN
00085 # include <atlwin.h>
00086 #endif
00087
00088
00089
00090
00091
00092 #ifndef _ATLSTL_NO_NAMESPACE
00093 # if defined(_STLSOFT_NO_NAMESPACE) || \
00094 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00095
00096 namespace atlstl
00097 {
00098 # else
00099
00100
00101 namespace stlsoft
00102 {
00103
00104 namespace atlstl_project
00105 {
00106
00107 # endif
00108 #endif
00109
00110
00111
00112
00113
00119 template <int N>
00120 struct IDD_to_type
00121 {
00122 enum { IDD = N };
00123 };
00124
00130
00131 template< class T
00132 , class B = CWindow
00133 >
00134 class AboutDialog
00135 : public CDialogImplBaseT<B>
00136 {
00137 public:
00138 typedef CDialogImplBaseT<B> parent_class_type;
00139 typedef AboutDialog<T, B> class_type;
00140
00141 public:
00142 INT_PTR DoModal()
00143 {
00144 return this->DoModal(::GetActiveWindow());
00145 }
00146
00147 INT_PTR DoModal(HWND hWndParent)
00148 {
00149 ATLASSERT(m_hWnd == NULL);
00150
00151
00152 parent_class_type *pThis = this;
00153 _Module.AddCreateWndData(&m_thunk.cd, pThis);
00154
00155 int nRet = ::DialogBox(_Module.GetResourceInstance(), MAKEINTRESOURCE(T::IDD), hWndParent, (DLGPROC)StartDialogProc);
00156
00157 m_hWnd = NULL;
00158
00159 return nRet;
00160 }
00161
00162 BEGIN_MSG_MAP(class_type)
00163 MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
00164 COMMAND_RANGE_HANDLER(IDOK, IDNO, OnCloseCmd)
00165 MESSAGE_HANDLER(WM_COMMAND, OnCommand)
00166 END_MSG_MAP()
00167
00168 protected:
00169 LRESULT OnInitDialog(UINT , WPARAM , LPARAM , BOOL& )
00170 {
00171 CenterWindow(GetParent());
00172
00173 return TRUE;
00174 }
00175
00176 LRESULT OnCloseCmd(WORD , WORD wID, HWND , BOOL& )
00177 {
00178 ::EndDialog(m_hWnd, wID);
00179
00180 return 0;
00181 }
00182
00183 LRESULT OnCommand(UINT , WPARAM , LPARAM lParam, BOOL &bHandled)
00184 {
00185 bHandled = false;
00186
00187 HWND hwndCtrl = (HWND)lParam;
00188
00189
00190 if(NULL != hwndCtrl)
00191 {
00192
00193 LRESULT ctrlCode = ::SendMessage(hwndCtrl, WM_GETDLGCODE, 0, 0L);
00194
00195 if(DLGC_BUTTON & ctrlCode)
00196 {
00197 typedef ::stlsoft::auto_buffer_old< TCHAR
00198 , ::stlsoft::malloc_allocator<TCHAR>
00199 , 512
00200 > buffer_t;
00201
00202
00203
00204
00205
00206 buffer_t buffer(1 + ::GetWindowTextLength(hwndCtrl));
00207 const int len = ::GetWindowText(hwndCtrl, &buffer[0], buffer.size());
00208
00209 buffer[len] = '\0';
00210
00211
00212 if( 0 < len &&
00213 NULL != _tcschr(buffer.data(), '.'))
00214 {
00215 SHELLEXECUTEINFO sei;
00216
00217 sei.cbSize = sizeof(sei);
00218 sei.fMask = SEE_MASK_NOCLOSEPROCESS;
00219 sei.hwnd = *this;
00220 sei.lpVerb = _T("open");
00221 sei.lpFile = buffer.data();
00222 sei.lpParameters = NULL;
00223 sei.lpDirectory = NULL;
00224 sei.nShow = SW_SHOWNORMAL;
00225 sei.hInstApp = NULL;
00226 sei.lpIDList = NULL;
00227 sei.lpClass = NULL;
00228 sei.hkeyClass = NULL;
00229 sei.dwHotKey = NULL;
00230 sei.hIcon = NULL;
00231 sei.hProcess = NULL;
00232
00233
00234 (void)::ShellExecuteEx(&sei);
00235
00236 bHandled = true;
00237 }
00238 }
00239 }
00240
00241 return 0;
00242 }
00243 };
00244
00250
00251 template< UINT ID
00252 , class B = CWindow
00253 >
00254 class AboutDialogId
00255 : public AboutDialog<IDD_to_type<ID>, B>
00256 {
00257 };
00258
00259
00260
00261 #ifndef _ATLSTL_NO_NAMESPACE
00262 # if defined(_STLSOFT_NO_NAMESPACE) || \
00263 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00264 }
00265 # else
00266 }
00267 }
00268 # endif
00269 #endif
00270
00271
00272
00273 #endif
00274
00275