ReactOS  0.4.15-dev-3308-g9455def
atlwin.h
Go to the documentation of this file.
1 /*
2  * ReactOS ATL
3  *
4  * Copyright 2009 Andrew Hill <ash77@reactos.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #pragma once
22 
23 #if defined(__GNUC__) || defined(__clang__)
24 #define GCCU(x) x __attribute__((unused))
25 #define Unused(x)
26 #else
27 #define GCCU(x) (x)
28 #define Unused(x) (x);
29 #endif // __GNUC__
30 
31 #if !defined(_WIN64)
32 #ifdef SetWindowLongPtr
33 #undef SetWindowLongPtr
34 inline LONG_PTR SetWindowLongPtr(HWND hWnd, int nIndex, LONG_PTR dwNewLong)
35 {
36  return SetWindowLong(hWnd, nIndex, (LONG)dwNewLong);
37 }
38 #endif
39 
40 #ifdef GetWindowLongPtr
41 #undef GetWindowLongPtr
42 inline LONG_PTR GetWindowLongPtr(HWND hWnd, int nIndex)
43 {
44  return (LONG_PTR)GetWindowLong(hWnd, nIndex);
45 }
46 #endif
47 #endif // !_WIN64
48 
49 #pragma push_macro("SubclassWindow")
50 #undef SubclassWindow
51 
52 namespace ATL
53 {
54 
55 #ifndef GET_X_LPARAM
56 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
57 #endif
58 #ifndef GET_Y_LPARAM
59 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
60 #endif
61 
62 
63 
66 
67 template <DWORD t_dwStyle = 0, DWORD t_dwExStyle = 0>
69 {
70 public:
71  static DWORD GetWndStyle(DWORD dwStyle)
72  {
73  if (dwStyle == 0)
74  return t_dwStyle;
75  return dwStyle;
76  }
77 
78  static DWORD GetWndExStyle(DWORD dwExStyle)
79  {
80  if (dwExStyle == 0)
81  return t_dwExStyle;
82  return dwExStyle;
83  }
84 };
85 
89 
90 template <DWORD t_dwStyle = 0, DWORD t_dwExStyle = 0, class TWinTraits = CControlWinTraits>
92 {
93 public:
94  static DWORD GetWndStyle(DWORD dwStyle)
95  {
96  return dwStyle | t_dwStyle | TWinTraits::GetWndStyle(dwStyle);
97  }
98 
99  static DWORD GetWndExStyle(DWORD dwExStyle)
100  {
101  return dwExStyle | t_dwExStyle | TWinTraits::GetWndExStyle(dwExStyle);
102  }
103 };
104 
106 {
107 public:
109 public:
111  {
112  m_hMenu = hMenu;
113  }
114 
116  {
117  m_hMenu = (HMENU)(UINT_PTR)nID;
118  }
119 };
120 
121 class _U_RECT
122 {
123 public:
125 public:
126  _U_RECT(LPRECT lpRect)
127  {
128  m_lpRect = lpRect;
129  }
130 
132  {
133  m_lpRect = &rc;
134  }
135 };
136 
137 struct _ATL_MSG : public MSG
138 {
139 public:
141 public:
142  _ATL_MSG(HWND hWnd, UINT uMsg, WPARAM wParamIn, LPARAM lParamIn, BOOL bHandledIn = TRUE)
143  {
144  hwnd = hWnd;
145  message = uMsg;
146  wParam = wParamIn;
147  lParam = lParamIn;
148  time = 0;
149  pt.x = 0;
150  pt.y = 0;
151  bHandled = bHandledIn;
152  }
153 };
154 
155 #if defined(_M_IX86)
156 
157 #pragma pack(push,1)
158 struct thunkCode
159 {
160  DWORD m_mov; /* mov dword ptr [esp+4], m_this */
161  DWORD m_this;
162  BYTE m_jmp; /* jmp relproc */
163  DWORD m_relproc;
164 
165  void
166  Init(WNDPROC proc, void *pThis)
167  {
168  m_mov = 0x042444C7;
169  m_this = PtrToUlong(pThis);
170  m_jmp = 0xe9;
171  m_relproc = DWORD(reinterpret_cast<char *>(proc) - (reinterpret_cast<char *>(this) + sizeof(thunkCode)));
172  FlushInstructionCache(GetCurrentProcess(), this, sizeof(thunkCode));
173  }
174 };
175 #pragma pack(pop)
176 
177 #elif defined(_AMD64_)
178 
179 #pragma pack(push,1)
180 struct thunkCode
181 {
182  USHORT m_mov_rcx; /* mov rcx, m_this */
183  ULONG64 m_this;
184  USHORT m_mov_rax; /* mov rax, m_proc */
185  ULONG64 m_proc;
186  USHORT m_jmp; /* jmp rax */
187 
188  void
189  Init(WNDPROC proc, void *pThis)
190  {
191  m_mov_rcx = 0xb948;
192  m_this = (ULONG64)pThis;
193  m_mov_rax = 0xb848;
194  m_proc = (ULONG64)proc;
195  m_jmp = 0xe0ff;
196  FlushInstructionCache(GetCurrentProcess(), this, sizeof(thunkCode));
197  }
198 };
199 #pragma pack(pop)
200 
201 #elif defined(_M_ARM)
202 
203 #pragma pack(push,4)
204 struct thunkCode
205 {
206  DWORD m_mov_r0; /* mov r0, m_this */
207  DWORD m_mov_pc; /* mov pc, m_proc */
208  DWORD m_this;
209  DWORD m_proc;
210 
211  void
212  Init(WNDPROC proc, void *pThis)
213  {
214  m_mov_r0 = 0xE59F0000;
215  m_mov_pc = 0xE59FF000;
216  m_this = (DWORD)pThis;
217  m_proc = (DWORD)proc;
218  FlushInstructionCache(GetCurrentProcess(), this, sizeof(thunkCode));
219  }
220 };
221 #pragma pack(pop)
222 
223 #else
224 #error ARCH not supported
225 #endif
226 
228 {
229 public:
230  thunkCode *m_pthunk;
232 public:
233 
235  {
236  m_pthunk = (thunkCode*)VirtualAlloc(NULL, sizeof(thunkCode), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
237  }
238 
240  {
241  if (m_pthunk != NULL)
243  }
244 
245  BOOL Init(WNDPROC proc, void *pThis)
246  {
247  if (m_pthunk == NULL)
248  return FALSE;
249  m_pthunk->Init(proc, pThis);
250  return TRUE;
251  }
252 
254  {
255  return reinterpret_cast<WNDPROC>(m_pthunk);
256  }
257 };
258 
260 {
261 public:
262  virtual BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID) = 0;
263 };
264 
265 class CWindow
266 {
267 public:
269  static RECT rcDefault;
270 public:
272  {
273  m_hWnd = hWnd;
274  }
275 
276  operator HWND() const
277  {
278  return m_hWnd;
279  }
280 
282  {
283  return NULL;
284  }
285 
287  {
290  }
291 
292  void Attach(HWND hWndNew)
293  {
294  m_hWnd = hWndNew;
295  }
296 
298  {
300  return ::BeginPaint(m_hWnd, lpPaint);
301  }
302 
304  {
307  }
308 
309  BOOL CenterWindow(HWND hWndCenter = NULL)
310  {
312  if (hWndCenter == NULL)
313  hWndCenter = ::GetParent(m_hWnd);
314  if (hWndCenter == NULL)
315  return FALSE;
316  RECT wndCenterRect, wndRect;
317  if (!::GetWindowRect(hWndCenter, &wndCenterRect) || !::GetWindowRect(m_hWnd, &wndRect))
318  return FALSE;
319  int wndCenterWidth = wndCenterRect.right - wndCenterRect.left;
320  int wndCenterHeight = wndCenterRect.bottom - wndCenterRect.top;
321  int wndWidth = wndRect.right - wndRect.left;
322  int wndHeight = wndRect.bottom - wndRect.top;
324  wndCenterRect.left + ((wndCenterWidth - wndWidth + 1) >> 1),
325  wndCenterRect.top + ((wndCenterHeight - wndHeight + 1) >> 1),
326  wndWidth, wndHeight, TRUE);
327  }
328 
330  {
333  }
334 
335  BOOL CheckDlgButton(int nIDButton, UINT nCheck)
336  {
338  return ::CheckDlgButton(m_hWnd, nIDButton, nCheck);
339  }
340 
341  BOOL CheckRadioButton(int nIDFirstButton, int nIDLastButton, int nIDCheckButton)
342  {
344  return ::CheckRadioButton(m_hWnd, nIDFirstButton, nIDLastButton, nIDCheckButton);
345  }
346 
348  {
351  }
352 
354  {
357  }
358 
359  BOOL ClientToScreen(LPPOINT lpPoint) const
360  {
363  }
364 
365  BOOL ClientToScreen(LPRECT lpRect) const
366  {
367  if (lpRect == NULL)
368  return FALSE;
370  POINT leftTop = {lpRect->left, lpRect->top};
371  POINT rightBottom = {lpRect->right, lpRect->bottom};
372  BOOL success = ::ClientToScreen(m_hWnd, &leftTop) && ::ClientToScreen(m_hWnd, &rightBottom);
373  if (success)
374  {
375  lpRect->left = leftTop.x;
376  lpRect->top = leftTop.y;
377  lpRect->right = rightBottom.x;
378  lpRect->bottom = rightBottom.y;
379  }
380  return success;
381  }
382 
383  HWND Create(LPCTSTR lpstrWndClass, HWND hWndParent, _U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, _U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
384  {
385  HWND hWnd;
386  ATLASSERT(m_hWnd == NULL);
387  hWnd = ::CreateWindowEx(dwExStyle,
388  lpstrWndClass,
389  szWindowName,
390  dwStyle,
391  rect.m_lpRect->left,
392  rect.m_lpRect->top,
393  rect.m_lpRect->right - rect.m_lpRect->left,
394  rect.m_lpRect->bottom - rect.m_lpRect->top,
395  hWndParent,
396  MenuOrID.m_hMenu,
397  _AtlBaseModule.GetModuleInstance(),
398  lpCreateParam);
399  if (hWnd != NULL)
400  m_hWnd = hWnd;
401  return hWnd;
402  }
403 
405  {
407  return ::CreateCaret(m_hWnd, pBitmap, 0, 0);
408  }
409 
410  BOOL CreateGrayCaret(int nWidth, int nHeight)
411  {
413  return ::CreateCaret(m_hWnd, (HBITMAP)1, nWidth, nHeight);
414  }
415 
416  BOOL CreateSolidCaret(int nWidth, int nHeight)
417  {
419  return ::CreateCaret(m_hWnd, (HBITMAP)0, nWidth, nHeight);
420  }
421 
422  HDWP DeferWindowPos(HDWP hWinPosInfo, HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT uFlags)
423  {
425  return ::DeferWindowPos(hWinPosInfo, m_hWnd, hWndInsertAfter, x, y, cx, cy, uFlags);
426  }
427 
429  {
431 
432  if (!::DestroyWindow(m_hWnd))
433  return FALSE;
434 
435  m_hWnd = NULL;
436  return TRUE;
437  }
438 
440  {
441  HWND hWnd = m_hWnd;
442  m_hWnd = NULL;
443  return hWnd;
444  }
445 
446  int DlgDirList(LPTSTR lpPathSpec, int nIDListBox, int nIDStaticPath, UINT nFileType)
447  {
449  return ::DlgDirList(m_hWnd, lpPathSpec, nIDListBox, nIDStaticPath, nFileType);
450  }
451 
452  int DlgDirListComboBox(LPTSTR lpPathSpec, int nIDComboBox, int nIDStaticPath, UINT nFileType)
453  {
455  return ::DlgDirListComboBox(m_hWnd, lpPathSpec, nIDComboBox, nIDStaticPath, nFileType);
456  }
457 
458  BOOL DlgDirSelect(LPTSTR lpString, int nCount, int nIDListBox)
459  {
461  return ::DlgDirSelectEx(m_hWnd, lpString, nCount, nIDListBox);
462  }
463 
464  BOOL DlgDirSelectComboBox(LPTSTR lpString, int nCount, int nIDComboBox)
465  {
467  return ::DlgDirSelectComboBoxEx(m_hWnd, lpString, nCount, nIDComboBox);
468  }
469 
470  void DragAcceptFiles(BOOL bAccept = TRUE)
471  {
473 // FIXME following line requires shellapi.h
474 // ::DragAcceptFiles(m_hWnd, bAccept);
475  }
476 
478  {
481  }
482 
483  BOOL EnableScrollBar(UINT uSBFlags, UINT uArrowFlags = ESB_ENABLE_BOTH)
484  {
486  return ::EnableScrollBar(m_hWnd, uSBFlags, uArrowFlags);
487  }
488 
490  {
493  }
494 
495  void EndPaint(LPPAINTSTRUCT lpPaint)
496  {
498  ::EndPaint(m_hWnd, lpPaint);
499  }
500 
502  {
505  }
506 
507  BOOL GetClientRect(LPRECT lpRect) const
508  {
511  }
512 
514  {
517  }
518 
519  HDC GetDCEx(HRGN hRgnClip, DWORD flags)
520  {
522  return ::GetDCEx(m_hWnd, hRgnClip, flags);
523  }
524 
525 private:
526  typedef struct _IDHWNDPAIR {
527  int nID;
530 
532  {
533  if (::GetWindowLong(hWnd, GWL_ID) == ((PIDHWNDPAIR)lParam)->nID)
534  {
535  ((PIDHWNDPAIR)lParam)->hWnd = hWnd;
536  return FALSE;
537  }
539  return (((PIDHWNDPAIR)lParam)->hWnd == NULL);
540  }
541 
542 public:
543  HWND GetDescendantWindow(int nID) const
544  {
546  IDHWNDPAIR idHWndPair;
547  idHWndPair.nID = nID;
548  idHWndPair.hWnd = NULL;
550  return idHWndPair.hWnd;
551  }
552 
553  HRESULT GetDlgControl(int nID, REFIID iid, void** ppCtrl)
554  {
556  return E_FAIL;//FIXME stub
557  }
558 
559  int GetDlgCtrlID() const
560  {
563  }
564 
565  HRESULT GetDlgHost(int nID, REFIID iid, void** ppHost)
566  {
568  return E_FAIL;//FIXME stub
569  }
570 
571  HWND GetDlgItem(int nID)
572  {
575  }
576 
577  UINT GetDlgItemInt(int nID, BOOL* lpTrans = NULL, BOOL bSigned = TRUE) const
578  {
580  return ::GetDlgItemInt(m_hWnd, nID, lpTrans, bSigned);
581  }
582 
583  UINT GetDlgItemText(int nID, LPTSTR lpStr, int nMaxCount) const
584  {
587  }
588 
589 #ifdef __ATLSTR_H__
590  UINT GetDlgItemText(int nID, CSimpleString& string)
591  {
592  HWND item = GetDlgItem(nID);
594  len = GetDlgItemText(nID, string.GetBuffer(len+1), len+1);
595  string.ReleaseBuffer(len);
596  return len;
597  }
598 #endif
599 
600  BOOL GetDlgItemText(int nID, BSTR& bstrText) const
601  {
603  return FALSE;//FIXME stub
604  }
605 
607  {
610  }
611 
612  HFONT GetFont() const
613  {
615  return (HFONT)::SendMessage(m_hWnd, WM_GETFONT, 0, 0);
616  }
617 
618  DWORD GetHotKey() const
619  {
621  return (DWORD)::SendMessage(m_hWnd, WM_GETHOTKEY, 0, 0);
622  }
623 
624  HICON GetIcon(BOOL bBigIcon = TRUE) const
625  {
627  return (HICON)::SendMessage(m_hWnd, WM_GETICON, (WPARAM)bBigIcon, 0);
628  }
629 
631  {
634  }
635 
636  HMENU GetMenu() const
637  {
640  }
641 
642  HWND GetNextDlgGroupItem(HWND hWndCtl, BOOL bPrevious = FALSE) const
643  {
645  return ::GetNextDlgGroupItem(m_hWnd, hWndCtl, bPrevious);
646  }
647 
648  HWND GetNextDlgTabItem(HWND hWndCtl, BOOL bPrevious = FALSE) const
649  {
651  return ::GetNextDlgTabItem(m_hWnd, hWndCtl, bPrevious);
652  }
653 
655  {
657  return CWindow(::GetParent(m_hWnd));
658  }
659 
660  BOOL GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo)
661  {
663  return ::GetScrollInfo(m_hWnd, nBar, lpScrollInfo);
664  }
665 
666  BOOL GetScrollPos(int nBar)
667  {
670  }
671 
672  BOOL GetScrollRange(int nBar, LPINT lpMinPos, LPINT lpMaxPos) const
673  {
675  return ::GetScrollRange(m_hWnd, nBar, lpMinPos, lpMaxPos);
676  }
677 
678  DWORD GetStyle() const
679  {
682  }
683 
685  {
687  return ::GetSystemMenu(m_hWnd, bRevert);
688  }
689 
691  {
693  return NULL;//FIXME stub
694  }
695 
697  {
699  return NULL;//FIXME stub
700  }
701 
703  {
706  }
707 
708  BOOL GetUpdateRect(LPRECT lpRect, BOOL bErase = FALSE)
709  {
711  return ::GetUpdateRect(m_hWnd, lpRect, bErase);
712  }
713 
714  int GetUpdateRgn(HRGN hRgn, BOOL bErase = FALSE)
715  {
718  }
719 
720  HWND GetWindow(UINT nCmd) const
721  {
723  return ::GetWindow(m_hWnd, nCmd);
724  }
725 
727  {
730  }
731 
733  {
736  }
737 
738  LONG GetWindowLong(int nIndex) const
739  {
742  }
743 
744  LONG_PTR GetWindowLongPtr(int nIndex) const
745  {
748  }
749 
751  {
754  }
755 
757  {
759  DWORD processID;
760  ::GetWindowThreadProcessId(m_hWnd, &processID);
761  return processID;
762  }
763 
764  BOOL GetWindowRect(LPRECT lpRect) const
765  {
768  }
769 
770  int GetWindowRgn(HRGN hRgn)
771  {
774  }
775 
776  int GetWindowText(LPTSTR lpszStringBuf, int nMaxCount) const
777  {
779  return ::GetWindowText(m_hWnd, lpszStringBuf, nMaxCount);
780  }
781 
783  {
786  if (!::SysReAllocStringLen(&bstrText, NULL, length))
787  return FALSE;
788  if (::GetWindowTextW(m_hWnd, bstrText, length + 1))
789  return TRUE;
790  ::SysFreeString(bstrText);
791  bstrText = NULL;
792  return FALSE;
793  }
794 
796  {
799  }
800 
802  {
805  }
806 
807  WORD GetWindowWord(int nIndex) const
808  {
810  return (WORD)::GetWindowLong(m_hWnd, nIndex);
811  }
812 
813  void GotoDlgCtrl(HWND hWndCtrl) const
814  {
817  }
818 
820  {
823  }
824 
825  BOOL HiliteMenuItem(HMENU hMenu, UINT uHiliteItem, UINT uHilite)
826  {
828  return ::HiliteMenuItem(m_hWnd, hMenu, uHiliteItem, uHilite);
829  }
830 
832  {
835  }
836 
837  BOOL InvalidateRect(LPCRECT lpRect, BOOL bErase = TRUE)
838  {
840  return ::InvalidateRect(m_hWnd, lpRect, bErase);
841  }
842 
843  void InvalidateRgn(HRGN hRgn, BOOL bErase = TRUE)
844  {
846  ::InvalidateRgn(m_hWnd, hRgn, bErase);
847  }
848 
849  BOOL IsChild(const HWND hWnd) const
850  {
853  }
854 
856  {
859  }
860 
861  UINT IsDlgButtonChecked(int nIDButton) const
862  {
865  }
866 
867  BOOL IsIconic() const
868  {
871  }
872 
874  {
876  TCHAR pszType[10];
877  if (!RealGetWindowClass(::GetParent(m_hWnd), pszType, sizeof(pszType) / sizeof(pszType[0])))
878  return FALSE;
879  return !_tcscmp(pszType, _T("#32770"));
880  }
881 
882  BOOL IsWindow() const
883  {
885  }
886 
888  {
891  }
892 
894  {
897  }
898 
900  {
903  }
904 
905  BOOL IsZoomed() const
906  {
909  }
910 
912  {
914  return ::KillTimer(m_hWnd, nIDEvent);
915  }
916 
918  {
920  if (bLock)
923  }
924 
925  int MapWindowPoints(HWND hWndTo, LPPOINT lpPoint, UINT nCount) const
926  {
928  return ::MapWindowPoints(m_hWnd, hWndTo, lpPoint, nCount);
929  }
930 
931  int MapWindowPoints(HWND hWndTo, LPRECT lpRect) const
932  {
934  return ::MapWindowPoints(m_hWnd, hWndTo, (LPPOINT)lpRect, sizeof(RECT) / sizeof(POINT));
935  }
936 
937  int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK)
938  {
940  return ::MessageBox(m_hWnd, lpszText, lpszCaption, nType);
941  }
942 
943  BOOL ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0)
944  {
946  ::SetWindowLong(m_hWnd, GWL_STYLE, (::GetWindowLong(m_hWnd, GWL_STYLE) & ~dwRemove) | dwAdd);
947  if (nFlags != 0)
949  return TRUE;
950  }
951 
952  BOOL ModifyStyleEx(DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0)
953  {
955  ::SetWindowLong(m_hWnd, GWL_EXSTYLE, (::GetWindowLong(m_hWnd, GWL_EXSTYLE) & ~dwRemove) | dwAdd);
956  if (nFlags != 0)
958  return TRUE;
959  }
960 
961  BOOL MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE)
962  {
964  return ::MoveWindow(m_hWnd, x, y, nWidth, nHeight, bRepaint);
965  }
966 
967  void NextDlgCtrl() const
968  {
971  }
972 
974  {
977  }
978 
980  {
983  }
984 
985  void PrevDlgCtrl() const
986  {
989  }
990 
991  void Print(HDC hDC, DWORD dwFlags) const
992  {
995  }
996 
998  {
1001  }
1002 
1003  BOOL RedrawWindow(LPCRECT lpRectUpdate = NULL, HRGN hRgnUpdate = NULL, UINT flags = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE)
1004  {
1006  return ::RedrawWindow(m_hWnd, lpRectUpdate, hRgnUpdate, flags);
1007  }
1008 
1010  {
1013  }
1014 
1015  BOOL ResizeClient(int nWidth, int nHeight, BOOL bRedraw = FALSE)
1016  {
1018  RECT clientRect, wndRect;
1019  ::GetClientRect(m_hWnd, &clientRect);
1020  ::GetWindowRect(m_hWnd, &wndRect);
1021  return ::MoveWindow(m_hWnd, wndRect.left, wndRect.top,
1022  nWidth + (wndRect.right - wndRect.left) - (clientRect.right - clientRect.left),
1023  nHeight + (wndRect.bottom - wndRect.top) - (clientRect.bottom - clientRect.top),
1024  bRedraw);
1025  }
1026 
1027  BOOL ScreenToClient(LPPOINT lpPoint) const
1028  {
1030  return ::ScreenToClient(m_hWnd, lpPoint);
1031  }
1032 
1033  BOOL ScrollWindow(int xAmount, int yAmount, LPCRECT lpRect = NULL, LPCRECT lpClipRect = NULL)
1034  {
1036  return ::ScrollWindow(m_hWnd, xAmount, yAmount, lpRect, lpClipRect);
1037  }
1038 
1039  int ScrollWindowEx(int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate, UINT flags)
1040  {
1042  return ::ScrollWindowEx(m_hWnd, dx, dy, lpRectScroll, lpRectClip, hRgnUpdate, lpRectUpdate, flags);
1043  }
1044 
1046  {
1049  }
1050 
1052  {
1055  }
1056 
1058  {
1059  ATLASSERT(::IsWindow(hWnd));
1061  }
1062 
1063 private:
1065  {
1067  return TRUE;
1068  }
1069 
1071  {
1074  return TRUE;
1075  }
1076 
1077 public:
1079  {
1081  MSG msg;
1082  msg.message = message;
1083  msg.wParam = wParam;
1084  msg.lParam = lParam;
1085  if (bDeep)
1087  else
1089  }
1090 
1092  {
1095  }
1096 
1098  {
1101  }
1102 
1104  {
1107  }
1108 
1110  {
1113  }
1114 
1115  int SetDlgCtrlID(int nID)
1116  {
1119  }
1120 
1121  BOOL SetDlgItemInt(int nID, UINT nValue, BOOL bSigned = TRUE)
1122  {
1124  return ::SetDlgItemInt(m_hWnd, nID, nValue, bSigned);
1125  }
1126 
1127  BOOL SetDlgItemText(int nID, LPCTSTR lpszString)
1128  {
1130  return ::SetDlgItemText(m_hWnd, nID, lpszString);
1131  }
1132 
1134  {
1137  }
1138 
1139  void SetFont(HFONT hFont, BOOL bRedraw = TRUE)
1140  {
1143  }
1144 
1145  int SetHotKey(WORD wVirtualKeyCode, WORD wModifiers)
1146  {
1148  return ::SendMessage(m_hWnd, WM_SETHOTKEY, MAKEWPARAM(wVirtualKeyCode, wModifiers), 0);
1149  }
1150 
1152  {
1154  return (HICON)::SendMessage(m_hWnd, WM_SETICON, (WPARAM)bBigIcon, (LPARAM)hIcon);
1155  }
1156 
1158  {
1160  return ::SetMenu(m_hWnd, hMenu);
1161  }
1162 
1163  HWND SetParent(HWND hWndNewParent)
1164  {
1166  return ::SetParent(m_hWnd, hWndNewParent);
1167  }
1168 
1169  void SetRedraw(BOOL bRedraw = TRUE)
1170  {
1172  ::SendMessage(m_hWnd, WM_SETREDRAW, (WPARAM)bRedraw, 0);
1173  }
1174 
1175  int SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE)
1176  {
1178  return ::SetScrollInfo(m_hWnd, nBar, lpScrollInfo, bRedraw);
1179  }
1180 
1181  int SetScrollPos(int nBar, int nPos, BOOL bRedraw = TRUE)
1182  {
1184  return ::SetScrollPos(m_hWnd, nBar, nPos, bRedraw);
1185  }
1186 
1187  BOOL SetScrollRange(int nBar, int nMinPos, int nMaxPos, BOOL bRedraw = TRUE)
1188  {
1190  return ::SetScrollRange(m_hWnd, nBar, nMinPos, nMaxPos, bRedraw);
1191  }
1192 
1193  UINT_PTR SetTimer(UINT_PTR nIDEvent, UINT nElapse, void (CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD) = NULL)
1194  {
1196  return ::SetTimer(m_hWnd, nIDEvent, nElapse, reinterpret_cast<TIMERPROC>(lpfnTimer));
1197  }
1198 
1200  {
1202  return ::SetWindowContextHelpId(m_hWnd, dwContextHelpId);
1203  }
1204 
1205  LONG SetWindowLong(int nIndex, LONG dwNewLong)
1206  {
1208  return ::SetWindowLong(m_hWnd, nIndex, dwNewLong);
1209  }
1210 
1211  LONG_PTR SetWindowLongPtr(int nIndex, LONG_PTR dwNewLong)
1212  {
1214  return ::SetWindowLongPtr(m_hWnd, nIndex, dwNewLong);
1215  }
1216 
1218  {
1221  }
1222 
1223  BOOL SetWindowPos(HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
1224  {
1226  return ::SetWindowPos(m_hWnd, hWndInsertAfter, x, y, cx, cy, nFlags);
1227  }
1228 
1229  int SetWindowRgn(HRGN hRgn, BOOL bRedraw = FALSE)
1230  {
1232  return ::SetWindowRgn(m_hWnd, hRgn, bRedraw);
1233  }
1234 
1236  {
1238  return ::SetWindowText(m_hWnd, lpszString);
1239  }
1240 
1241  WORD SetWindowWord(int nIndex, WORD wNewWord)
1242  {
1244  if (nIndex >= -4)
1245  return ::SetWindowLong(m_hWnd, nIndex - 2, MAKELONG(LOWORD(::GetWindowLong(m_hWnd, nIndex - 2)), wNewWord));
1246  else
1247  return ::SetWindowLong(m_hWnd, nIndex, MAKELONG(wNewWord, HIWORD(::GetWindowLong(m_hWnd, nIndex))));
1248  }
1249 
1251  {
1254  }
1255 
1257  {
1260  }
1261 
1263  {
1265  return ::ShowScrollBar(m_hWnd, nBar, bShow);
1266  }
1267 
1268  BOOL ShowWindow(int nCmdShow)
1269  {
1271  return ::ShowWindow(m_hWnd, nCmdShow);
1272  }
1273 
1274  BOOL ShowWindowAsync(int nCmdShow)
1275  {
1277  return ::ShowWindowAsync(m_hWnd, nCmdShow);
1278  }
1279 
1281  {
1284  }
1285 
1287  {
1289  return ::ValidateRect(m_hWnd, lpRect);
1290  }
1291 
1293  {
1296  }
1297 
1299  {
1301  return ::WinHelp(m_hWnd, lpszHelp, nCmd, dwData);
1302  }
1303 };
1304 
1306 
1307 template <class TBase = CWindow>
1308 class CWindowImplRoot : public TBase, public CMessageMap
1309 {
1310 public:
1311  enum { WINSTATE_DESTROYED = 0x00000001 };
1312 
1313 public:
1317 
1319  : m_pCurrentMsg(NULL)
1320  , m_dwState(0)
1321  {
1322  }
1323 
1325  {
1326  }
1327 };
1328 
1329 
1330 template <class TBase = CWindow>
1331 class CDialogImplBaseT : public CWindowImplRoot<TBase>
1332 {
1333 public:
1334  // + Hacks for gcc
1336  // - Hacks for gcc
1337 
1339  {
1340  }
1342  {
1343  return DialogProc;
1344  }
1345 
1347  {
1348  CDialogImplBaseT<TBase> *pThis;
1349  DLGPROC newDlgProc;
1350  DLGPROC GCCU(pOldProc);
1351 
1352  pThis = reinterpret_cast<CDialogImplBaseT<TBase>*>(_AtlWinModule.ExtractCreateWndData());
1353  ATLASSERT(pThis != NULL);
1354  if (pThis == NULL)
1355  return 0;
1356  pThis->m_thunk.Init((WNDPROC)pThis->GetDialogProc(), pThis);
1357  newDlgProc = reinterpret_cast<DLGPROC>(pThis->m_thunk.GetWNDPROC());
1358  pOldProc = reinterpret_cast<DLGPROC>(::SetWindowLongPtr(hWnd, DWLP_DLGPROC, reinterpret_cast<LONG_PTR>(newDlgProc)));
1359  Unused(pOldProc); // TODO: should generate trace message if overwriting another subclass
1360  pThis->m_hWnd = hWnd;
1361  return newDlgProc(hWnd, uMsg, wParam, lParam);
1362  }
1363 
1365  {
1366  CDialogImplBaseT<TBase> *pThis = reinterpret_cast<CDialogImplBaseT<TBase>*>(hWnd);
1367  _ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
1368  LRESULT lResult = 0;
1369  const _ATL_MSG *previousMessage;
1370  BOOL handled;
1371 
1372  hWnd = pThis->m_hWnd;
1373  previousMessage = pThis->m_pCurrentMsg;
1374  pThis->m_pCurrentMsg = &msg;
1375 
1376  handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
1377  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1378 
1379  if (handled)
1380  {
1381  if ((pThis->m_dwState & WINSTATE_DESTROYED) == 0)
1382  {
1383  ::SetWindowLongPtr(pThis->m_hWnd, DWLP_MSGRESULT, lResult);
1384  }
1385  }
1386  else
1387  {
1388  if (uMsg == WM_NCDESTROY)
1389  {
1390  pThis->m_dwState |= WINSTATE_DESTROYED;
1391  }
1392  }
1393 
1394  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1395  pThis->m_pCurrentMsg = previousMessage;
1396 
1397  if (previousMessage == NULL && (pThis->m_dwState & WINSTATE_DESTROYED) != 0)
1398  {
1399  pThis->m_dwState &= ~WINSTATE_DESTROYED;
1400  pThis->m_hWnd = NULL;
1401  pThis->OnFinalMessage(hWnd);
1402  }
1403  return lResult;
1404  }
1405 
1406  virtual void OnFinalMessage(HWND)
1407  {
1408  }
1409 };
1410 
1411 
1412 template <class T, class TBase = CWindow>
1413 class CDialogImpl : public CDialogImplBaseT< TBase >
1414 {
1415 public:
1416  // + Hacks for gcc
1419  // - Hacks for gcc
1420 
1422  {
1423  BOOL result;
1424  HWND hWnd;
1425  T* pImpl;
1426 
1427  result = m_thunk.Init(NULL, NULL);
1428  if (result == FALSE)
1429  return NULL;
1430 
1431  _AtlWinModule.AddCreateWndData(&m_thunk.cd, this);
1432 
1433  pImpl = static_cast<T*>(this);
1434  hWnd = ::CreateDialogParam(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(pImpl->IDD), hWndParent, T::StartDialogProc, dwInitParam);
1435  return hWnd;
1436  }
1437 
1439  {
1440  BOOL result;
1441  T* pImpl;
1442 
1443  result = m_thunk.Init(NULL, NULL);
1444  if (result == FALSE)
1445  return -1;
1446 
1447  _AtlWinModule.AddCreateWndData(&m_thunk.cd, this);
1448 
1449  pImpl = static_cast<T*>(this);
1450  return ::DialogBoxParam(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(pImpl->IDD), hWndParent, T::StartDialogProc, dwInitParam);
1451  }
1452 
1453  BOOL EndDialog(_In_ int nRetCode)
1454  {
1455  return ::EndDialog(m_hWnd, nRetCode);
1456  }
1457 
1459  {
1460  return ::DestroyWindow(m_hWnd);
1461  }
1462 };
1463 
1464 template <class TBase = CWindow, class TWinTraits = CControlWinTraits>
1465 class CWindowImplBaseT : public CWindowImplRoot<TBase>
1466 {
1467 public:
1468  // + Hacks for gcc
1472  // - Hacks for gcc
1473 
1475 
1476 public:
1478  {
1480  }
1481 
1482  virtual void OnFinalMessage(HWND /* hWnd */)
1483  {
1484  }
1485 
1487  {
1488  ATLASSERT(m_hWnd == NULL);
1489  ATLASSERT(::IsWindow(hWnd));
1490 
1492  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
1493 
1494  BOOL result = m_thunk.Init(GetWindowProc(), this);
1495  if (result == FALSE)
1496  return FALSE;
1497 
1498  WNDPROC newWindowProc = m_thunk.GetWNDPROC();
1499  WNDPROC oldWindowProc = reinterpret_cast<WNDPROC>(
1500  ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
1501  if (oldWindowProc == NULL)
1502  return FALSE;
1503 
1504  pThis->m_pfnSuperWindowProc = oldWindowProc;
1505  pThis->m_hWnd = hWnd;
1506  return TRUE;
1507  }
1508 
1510  {
1511  ATLASSERT(m_hWnd != NULL);
1512  ATLASSERT(::IsWindow(m_hWnd));
1513 
1515  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
1516 
1517  HWND hwndOld = pThis->m_hWnd;
1518  WNDPROC oldWindowProc = m_thunk.GetWNDPROC();
1519  WNDPROC subclassedProc = reinterpret_cast<WNDPROC>(
1520  ::GetWindowLongPtr(hwndOld, GWLP_WNDPROC));
1521  if (!bForce && oldWindowProc != subclassedProc)
1522  return NULL;
1523 
1525  (LONG_PTR)pThis->m_pfnSuperWindowProc);
1527  pThis->m_hWnd = NULL;
1528  return hwndOld;
1529  }
1530 
1532  {
1533  return WindowProc;
1534  }
1535 
1536  static DWORD GetWndStyle(DWORD dwStyle)
1537  {
1538  return TWinTraits::GetWndStyle(dwStyle);
1539  }
1540 
1541  static DWORD GetWndExStyle(DWORD dwExStyle)
1542  {
1543  return TWinTraits::GetWndExStyle(dwExStyle);
1544  }
1545 
1547  {
1549 
1550  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits> *>(this);
1552  }
1553 
1555  {
1557  WNDPROC newWindowProc;
1558  WNDPROC GCCU(pOldProc);
1559 
1560  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits> *>(_AtlWinModule.ExtractCreateWndData());
1561  ATLASSERT(pThis != NULL);
1562  if (pThis == NULL)
1563  return 0;
1564  pThis->m_thunk.Init(pThis->GetWindowProc(), pThis);
1565  newWindowProc = pThis->m_thunk.GetWNDPROC();
1566  pOldProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
1567  Unused(pOldProc); // TODO: should generate trace message if overwriting another subclass
1568  pThis->m_hWnd = hWnd;
1569  return newWindowProc(hWnd, uMsg, wParam, lParam);
1570  }
1571 
1573  {
1575  _ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
1576  LRESULT lResult;
1577  const _ATL_MSG *previousMessage;
1578  BOOL handled;
1579  LONG_PTR saveWindowProc;
1580 
1581  ATLASSERT(pThis != NULL);
1582  if (pThis == NULL)
1583  return 0;
1584 
1585  ATLASSERT((pThis->m_dwState & WINSTATE_DESTROYED) == 0);
1586  ATLASSERT(pThis->m_hWnd != NULL);
1587  if ((pThis->m_dwState & WINSTATE_DESTROYED) != 0 || pThis->m_hWnd == NULL)
1588  return 0;
1589 
1590  hWnd = pThis->m_hWnd;
1591  previousMessage = pThis->m_pCurrentMsg;
1592  pThis->m_pCurrentMsg = &msg;
1593 
1594  handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
1595  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1596 
1597  if (handled == FALSE)
1598  {
1599  if (uMsg == WM_NCDESTROY)
1600  {
1601  saveWindowProc = ::GetWindowLongPtr(hWnd, GWLP_WNDPROC);
1602  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1603  if (pThis->m_pfnSuperWindowProc != ::DefWindowProc && saveWindowProc == ::GetWindowLongPtr(hWnd, GWLP_WNDPROC))
1604  ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(pThis->m_pfnSuperWindowProc));
1605  pThis->m_dwState |= WINSTATE_DESTROYED;
1606  }
1607  else
1608  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1609  }
1610  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1611  pThis->m_pCurrentMsg = previousMessage;
1612  if (previousMessage == NULL && (pThis->m_dwState & WINSTATE_DESTROYED) != 0)
1613  {
1614  pThis->m_dwState &= ~WINSTATE_DESTROYED;
1615  pThis->m_hWnd = NULL;
1616  pThis->OnFinalMessage(hWnd);
1617  }
1618  return lResult;
1619  }
1620 
1621  HWND Create(HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle,
1622  _U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam)
1623  {
1624  HWND hWnd;
1625 
1626  ATLASSERT(m_hWnd == NULL);
1627  ATLASSERT(atom != 0);
1628  if (atom == 0)
1629  return NULL;
1630  if (m_thunk.Init(NULL, NULL) == FALSE)
1631  {
1633  return NULL;
1634  }
1635 
1636  _AtlWinModule.AddCreateWndData(&m_thunk.cd, this);
1637  if (MenuOrID.m_hMenu == NULL && (dwStyle & WS_CHILD) != 0)
1638  MenuOrID.m_hMenu = (HMENU)(UINT_PTR)this;
1639  if (rect.m_lpRect == NULL)
1640  rect.m_lpRect = &TBase::rcDefault;
1641  hWnd = ::CreateWindowEx(dwExStyle, MAKEINTATOM(atom), szWindowName, dwStyle, rect.m_lpRect->left,
1642  rect.m_lpRect->top, rect.m_lpRect->right - rect.m_lpRect->left, rect.m_lpRect->bottom - rect.m_lpRect->top,
1643  hWndParent, MenuOrID.m_hMenu, _AtlBaseModule.GetModuleInstance(), lpCreateParam);
1644 
1645  ATLASSERT(m_hWnd == hWnd);
1646 
1647  return hWnd;
1648  }
1649 };
1650 
1651 
1652 template <class T, class TBase = CWindow, class TWinTraits = CControlWinTraits>
1653 class CWindowImpl : public CWindowImplBaseT<TBase, TWinTraits>
1654 {
1655 public:
1656  // + Hacks for gcc
1658  // - Hacks for gcc
1659 
1660 
1662  {
1663  return NULL;
1664  }
1665 
1666  HWND Create(HWND hWndParent, _U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0,
1667  DWORD dwExStyle = 0, _U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
1668  {
1670  ATOM atom;
1671 
1672  ATLASSERT(m_hWnd == NULL);
1673  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
1674 
1675  if (T::GetWndClassInfo().m_lpszOrigName == NULL)
1676  T::GetWndClassInfo().m_lpszOrigName = pThis->GetWndClassName();
1677  atom = T::GetWndClassInfo().Register(&pThis->m_pfnSuperWindowProc);
1678 
1679  if (szWindowName == NULL)
1680  szWindowName = T::GetWndCaption();
1681  dwStyle = T::GetWndStyle(dwStyle);
1682  dwExStyle = T::GetWndExStyle(dwExStyle);
1683 
1684  return CWindowImplBaseT<TBase, TWinTraits>::Create(hWndParent, rect, szWindowName, dwStyle,
1685  dwExStyle, MenuOrID, atom, lpCreateParam);
1686  }
1687 };
1688 
1689 template <class TBase = CWindow, class TWinTraits = CControlWinTraits>
1690 class CContainedWindowT : public TBase
1691 {
1692 public:
1693  // + Hacks for gcc
1694  using TBase::m_hWnd;
1695  // - Hacks for gcc
1696 
1703 public:
1705  {
1706  m_lpszClassName = TBase::GetWndClassName();
1708  m_pObject = pObject;
1709  m_dwMsgMapID = dwMsgMapID;
1710  m_pCurrentMsg = NULL;
1711  }
1712 
1713  CContainedWindowT(LPCTSTR lpszClassName, CMessageMap *pObject, DWORD dwMsgMapID = 0)
1714  {
1715  m_lpszClassName = lpszClassName;
1717  m_pObject = pObject;
1718  m_dwMsgMapID = dwMsgMapID;
1719  m_pCurrentMsg = NULL;
1720  }
1721 
1723  {
1725  }
1726 
1728  {
1729  ATLASSERT(m_hWnd == NULL);
1730  ATLASSERT(::IsWindow(hWnd));
1731 
1732  CContainedWindowT<TBase> *pThis;
1733  pThis = reinterpret_cast<CContainedWindowT<TBase> *>(this);
1734 
1735  BOOL result = m_thunk.Init(WindowProc, pThis);
1736  if (result == FALSE)
1737  return FALSE;
1738 
1739  WNDPROC newWindowProc = m_thunk.GetWNDPROC();
1740  WNDPROC oldWindowProc = reinterpret_cast<WNDPROC>(
1741  ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
1742  if (oldWindowProc == NULL)
1743  return FALSE;
1744 
1745  pThis->m_pfnSuperWindowProc = oldWindowProc;
1746  pThis->m_hWnd = hWnd;
1747  return TRUE;
1748  }
1749 
1751  {
1752  ATLASSERT(m_hWnd != NULL);
1753  ATLASSERT(::IsWindow(m_hWnd));
1754 
1755  CContainedWindowT<TBase>* pThis;
1756  pThis = reinterpret_cast<CContainedWindowT<TBase>*>(this);
1757  HWND hwndOld = pThis->m_hWnd;
1758 
1759  WNDPROC subclassedProc = reinterpret_cast<WNDPROC>(
1760  ::GetWindowLongPtr(hwndOld, GWLP_WNDPROC));
1761  if (!bForce && m_thunk.GetWNDPROC() != subclassedProc)
1762  return NULL;
1763 
1765  (LONG_PTR)pThis->m_pfnSuperWindowProc);
1767  pThis->m_hWnd = NULL;
1768  return hwndOld;
1769  }
1770 
1772  {
1773  CContainedWindowT<TBase> *pThis;
1774  WNDPROC newWindowProc;
1775  WNDPROC GCCU(pOldProc);
1776 
1777  pThis = reinterpret_cast<CContainedWindowT<TBase> *>(_AtlWinModule.ExtractCreateWndData());
1778  ATLASSERT(pThis != NULL);
1779  if (pThis == NULL)
1780  return 0;
1781  pThis->m_thunk.Init(WindowProc, pThis);
1782  newWindowProc = pThis->m_thunk.GetWNDPROC();
1783  pOldProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
1784  Unused(pOldProc); // TODO: should generate trace message if overwriting another subclass
1785  pThis->m_hWnd = hWnd;
1786  return newWindowProc(hWnd, uMsg, wParam, lParam);
1787  }
1788 
1790  {
1791  CContainedWindowT<TBase> *pThis = reinterpret_cast<CContainedWindowT<TBase> *>(hWnd);
1792  _ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
1793  LRESULT lResult;
1794  const _ATL_MSG *previousMessage;
1795  BOOL handled;
1796  LONG_PTR saveWindowProc;
1797 
1798  ATLASSERT(pThis != NULL && pThis->m_hWnd != NULL && pThis->m_pObject != NULL);
1799  if (pThis == NULL || pThis->m_hWnd == NULL || pThis->m_pObject == NULL)
1800  return 0;
1801 
1802  hWnd = pThis->m_hWnd;
1803  previousMessage = pThis->m_pCurrentMsg;
1804  pThis->m_pCurrentMsg = &msg;
1805 
1806  handled = pThis->m_pObject->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, pThis->m_dwMsgMapID);
1807  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1808 
1809  pThis->m_pCurrentMsg = previousMessage;
1810  if (handled == FALSE)
1811  {
1812  if (uMsg == WM_NCDESTROY)
1813  {
1814  saveWindowProc = ::GetWindowLongPtr(hWnd, GWLP_WNDPROC);
1815  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1816  if (pThis->m_pfnSuperWindowProc != ::DefWindowProc && saveWindowProc == ::GetWindowLongPtr(hWnd, GWLP_WNDPROC))
1817  ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(pThis->m_pfnSuperWindowProc));
1818  pThis->m_hWnd = NULL;
1819  }
1820  else
1821  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1822  }
1823  return lResult;
1824  }
1825 
1826 };
1828 
1829 #define BEGIN_MSG_MAP(theClass) \
1830 public: \
1831  BOOL ProcessWindowMessage(HWND GCCU(hWnd), UINT GCCU(uMsg), WPARAM GCCU(wParam), LPARAM GCCU(lParam), LRESULT &GCCU(lResult), DWORD dwMsgMapID = 0) \
1832  { \
1833  BOOL GCCU(bHandled) = TRUE; \
1834  Unused(hWnd); \
1835  Unused(uMsg); \
1836  Unused(wParam); \
1837  Unused(lParam); \
1838  Unused(lResult); \
1839  Unused(bHandled); \
1840  switch(dwMsgMapID) \
1841  { \
1842  case 0:
1843 
1844 #define ALT_MSG_MAP(map) \
1845  break; \
1846  case map:
1847 
1848 #define END_MSG_MAP() \
1849  break; \
1850  default: \
1851  ATLASSERT(FALSE); \
1852  break; \
1853  } \
1854  return FALSE; \
1855  }
1856 
1857 #define MESSAGE_HANDLER(msg, func) \
1858  if (uMsg == msg) \
1859  { \
1860  bHandled = TRUE; \
1861  lResult = func(uMsg, wParam, lParam, bHandled); \
1862  if (bHandled) \
1863  return TRUE; \
1864  }
1865 
1866 #define MESSAGE_RANGE_HANDLER(msgFirst, msgLast, func) \
1867  if (uMsg >= msgFirst && uMsg <= msgLast) \
1868  { \
1869  bHandled = TRUE; \
1870  lResult = func(uMsg, wParam, lParam, bHandled); \
1871  if (bHandled) \
1872  return TRUE; \
1873  }
1874 
1875 #define COMMAND_HANDLER(id, code, func) \
1876  if (uMsg == WM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \
1877  { \
1878  bHandled = TRUE; \
1879  lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
1880  if (bHandled) \
1881  return TRUE; \
1882  }
1883 
1884 #define COMMAND_ID_HANDLER(id, func) \
1885  if (uMsg == WM_COMMAND && id == LOWORD(wParam)) \
1886  { \
1887  bHandled = TRUE; \
1888  lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
1889  if (bHandled) \
1890  return TRUE; \
1891  }
1892 
1893 #define COMMAND_CODE_HANDLER(code, func) \
1894  if (uMsg == WM_COMMAND && code == HIWORD(wParam)) \
1895  { \
1896  bHandled = TRUE; \
1897  lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
1898  if (bHandled) \
1899  return TRUE; \
1900  }
1901 
1902 #define COMMAND_RANGE_HANDLER(idFirst, idLast, func) \
1903  if (uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
1904  { \
1905  bHandled = TRUE; \
1906  lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
1907  if (bHandled) \
1908  return TRUE; \
1909  }
1910 
1911 #define NOTIFY_CODE_HANDLER(cd, func) \
1912  if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
1913  { \
1914  bHandled = TRUE; \
1915  lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
1916  if (bHandled) \
1917  return TRUE; \
1918  }
1919 
1920 #define NOTIFY_HANDLER(id, cd, func) \
1921  if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \
1922  { \
1923  bHandled = TRUE; \
1924  lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
1925  if (bHandled) \
1926  return TRUE; \
1927  }
1928 
1929 #define CHAIN_MSG_MAP(theChainClass) \
1930  { \
1931  if (theChainClass::ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult)) \
1932  return TRUE; \
1933  }
1934 
1935 #define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd) \
1936 static ATL::CWndClassInfo& GetWndClassInfo() \
1937 { \
1938  static ATL::CWndClassInfo wc = \
1939  { \
1940  { sizeof(WNDCLASSEX), style, StartWindowProc, \
1941  0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName, NULL }, \
1942  NULL, NULL, IDC_ARROW, TRUE, 0, _T("") \
1943  }; \
1944  return wc; \
1945 }
1946 
1948 {
1955  TCHAR m_szAutoName[sizeof("ATL:") + sizeof(void *) * 2]; // == 4 characters + NULL + number of hexadecimal digits describing a pointer.
1956 
1958  {
1959  if (m_wc.hInstance == NULL)
1960  m_wc.hInstance = _AtlBaseModule.GetModuleInstance();
1961  if (m_atom == 0)
1962  {
1963  if (m_bSystemCursor)
1965  else
1966  m_wc.hCursor = ::LoadCursor(_AtlBaseModule.GetResourceInstance(), m_lpszCursorID);
1967 
1969  }
1970 
1971  return m_atom;
1972  }
1973 };
1974 
1975 }; // namespace ATL
1976 
1977 #pragma pop_macro("SubclassWindow")
1978 
BOOL ChangeClipboardChain(HWND hWndNewNext)
Definition: atlwin.h:329
BOOL IsDialogMessage(LPMSG lpMsg)
Definition: atlwin.h:855
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
CWinTraits< WS_OVERLAPPEDWINDOW|WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, WS_EX_MDICHILD > CMDIChildWinTraits
Definition: atlwin.h:88
BOOL GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo)
Definition: atlwin.h:660
#define CallWindowProc
Definition: winuser.h:5711
BOOL ModifyStyleEx(DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
Definition: atlwin.h:952
HWND Create(HWND hWndParent, LPARAM dwInitParam=NULL)
Definition: atlwin.h:1421
BOOL WINAPI GetScrollRange(_In_ HWND, _In_ int, _Out_ LPINT, _Out_ LPINT)
BOOL IsWindowEnabled() const
Definition: atlwin.h:887
BOOL WINAPI ValidateRgn(_In_ HWND, _In_opt_ HRGN)
#define WM_SETHOTKEY
Definition: winuser.h:1635
HWND UnsubclassWindow(BOOL bForce=FALSE)
Definition: atlwin.h:1509
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
int MapWindowPoints(HWND hWndTo, LPPOINT lpPoint, UINT nCount) const
Definition: atlwin.h:925
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
FxObject * pObject
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)
BOOL GetScrollPos(int nBar)
Definition: atlwin.h:666
UINT ArrangeIconicWindows()
Definition: atlwin.h:286
Definition: tftpd.h:59
static HICON
Definition: imagelist.c:84
struct ATL::CWindow::_IDHWNDPAIR IDHWNDPAIR
#define REFIID
Definition: guiddef.h:118
#define MAKEWPARAM(l, h)
Definition: winuser.h:3985
HWND SetFocus()
Definition: atlwin.h:1133
static LPCTSTR GetWndClassName()
Definition: atlwin.h:281
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
DWORD GetExStyle() const
Definition: atlwin.h:606
BOOL MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint=TRUE)
Definition: atlwin.h:961
HWND GetWindow(UINT nCmd) const
Definition: atlwin.h:720
HWND WINAPI SetClipboardViewer(_In_ HWND)
BOOL WINAPI DrawMenuBar(_In_ HWND)
#define DWLP_DLGPROC
Definition: winuser.h:865
#define RegisterClassEx
Definition: winuser.h:5813
static DWORD GetWndStyle(DWORD dwStyle)
Definition: atlwin.h:94
DWORD GetWindowThreadID()
Definition: atlwin.h:801
UINT IsDlgButtonChecked(int nIDButton) const
Definition: atlwin.h:861
BOOL EndDialog(_In_ int nRetCode)
Definition: atlwin.h:1453
long y
Definition: polytest.cpp:48
DWORD GetStyle() const
Definition: atlwin.h:678
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
BOOL HiliteMenuItem(HMENU hMenu, UINT uHiliteItem, UINT uHilite)
Definition: atlwin.h:825
HCURSOR hCursor
Definition: winuser.h:3184
#define WM_NEXTDLGCTL
Definition: winuser.h:1626
GLuint64EXT * result
Definition: glext.h:11304
int SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw=TRUE)
Definition: atlwin.h:1175
BOOL WINAPI IsWindow(_In_opt_ HWND)
long x
Definition: polytest.cpp:48
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HMENU m_hMenu
Definition: atlwin.h:108
HDC WINAPI GetDC(_In_opt_ HWND)
WORD ATOM
Definition: dimm.idl:113
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
void SetFont(HFONT hFont, BOOL bRedraw=TRUE)
Definition: atlwin.h:1139
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
#define WM_GETHOTKEY
Definition: winuser.h:1636
BOOL WINAPI LockWindowUpdate(_In_opt_ HWND)
int GetWindowTextLength() const
Definition: atlwin.h:795
BOOL DlgDirSelect(LPTSTR lpString, int nCount, int nIDListBox)
Definition: atlwin.h:458
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
BOOL ShowWindowAsync(int nCmdShow)
Definition: atlwin.h:1274
HWND GetNextDlgGroupItem(HWND hWndCtl, BOOL bPrevious=FALSE) const
Definition: atlwin.h:642
#define DlgDirList
Definition: winuser.h:5742
static DWORD GetWndStyle(DWORD dwStyle)
Definition: atlwin.h:71
HWND Create(HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:1666
CContainedWindowT(LPCTSTR lpszClassName, CMessageMap *pObject, DWORD dwMsgMapID=0)
Definition: atlwin.h:1713
#define GWL_ID
Definition: winuser.h:853
BOOL GetUpdateRect(LPRECT lpRect, BOOL bErase=FALSE)
Definition: atlwin.h:708
HWND GetLastActivePopup() const
Definition: atlwin.h:630
GLint dy
Definition: linetemp.h:97
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1572
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
virtual ~CDialogImplBaseT()
Definition: atlwin.h:1338
BOOL EnableWindow(BOOL bEnable=TRUE)
Definition: atlwin.h:489
#define U(x)
Definition: wordpad.c:45
HWND GetDescendantWindow(int nID) const
Definition: atlwin.h:543
return pMemory GetBuffer()
_U_RECT(LPRECT lpRect)
Definition: atlwin.h:126
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:35
UINT WINAPI ArrangeIconicWindows(_In_ HWND)
#define WM_SETREDRAW
Definition: winuser.h:1599
CContainedWindowT< CWindow > CContainedWindow
Definition: atlwin.h:1827
BOOL IsWindow() const
Definition: atlwin.h:882
BOOL WINAPI ShowScrollBar(_In_ HWND, _In_ int, _In_ BOOL)
int GetWindowRgn(HRGN hRgn)
Definition: atlwin.h:770
BOOL WINAPI UpdateWindow(_In_ HWND)
HWND hWnd
Definition: settings.c:17
LONG SetWindowLong(int nIndex, LONG dwNewLong)
Definition: atlwin.h:1205
BOOL ScrollWindow(int xAmount, int yAmount, LPCRECT lpRect=NULL, LPCRECT lpClipRect=NULL)
Definition: atlwin.h:1033
BOOL SetWindowPos(HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
Definition: atlwin.h:1223
LONG top
Definition: windef.h:307
HANDLE HWND
Definition: compat.h:19
static HRGN hRgn
Definition: mapping.c:33
HFONT GetFont() const
Definition: atlwin.h:612
static HANDLE ULONG_PTR dwData
Definition: file.c:35
HRESULT GetDlgHost(int nID, REFIID iid, void **ppHost)
Definition: atlwin.h:565
#define GWL_EXSTYLE
Definition: winuser.h:845
int SetScrollPos(int nBar, int nPos, BOOL bRedraw=TRUE)
Definition: atlwin.h:1181
BOOL WinHelp(LPCTSTR lpszHelp, UINT nCmd=HELP_CONTEXT, DWORD dwData=0)
Definition: atlwin.h:1298
virtual void OnFinalMessage(HWND)
Definition: atlwin.h:1406
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HWND WINAPI SetFocus(_In_opt_ HWND)
virtual BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID)=0
BOOL WINAPI ChangeClipboardChain(_In_ HWND, _In_ HWND)
UINT_PTR WPARAM
Definition: windef.h:207
#define SetWindowLong
Definition: winuser.h:5829
void EndPaint(LPPAINTSTRUCT lpPaint)
Definition: atlwin.h:495
static HANDLE proc()
Definition: pdb.c:32
#define WS_CHILD
Definition: pedump.c:617
OLECHAR * BSTR
Definition: compat.h:2152
#define SendDlgItemMessage
Definition: winuser.h:5818
#define DlgDirSelectComboBoxEx
Definition: winuser.h:5744
BOOL Init(PUSERCONNECT UserCon)
Definition: dllmain.c:385
HRESULT GetDlgControl(int nID, REFIID iid, void **ppCtrl)
Definition: atlwin.h:553
__u16 time
Definition: mkdosfs.c:366
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1233
UINT uFlags
Definition: api.c:59
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI FlushInstructionCache(IN HANDLE hProcess, IN LPCVOID lpBaseAddress, IN SIZE_T nSize)
Definition: proc.c:1463
int32_t INT_PTR
Definition: typedefs.h:64
CWindow(HWND hWnd=NULL)
Definition: atlwin.h:271
#define IsDialogMessage
Definition: winuser.h:5785
WNDPROC GetWNDPROC()
Definition: atlwin.h:253
BOOL SetWindowText(LPCTSTR lpszString)
Definition: atlwin.h:1235
#define DlgDirListComboBox
Definition: winuser.h:5743
void DragAcceptFiles(BOOL bAccept=TRUE)
Definition: atlwin.h:470
LONG right
Definition: windef.h:308
HWND WINAPI GetNextDlgTabItem(_In_ HWND, _In_opt_ HWND, _In_ BOOL)
BOOL WINAPI IsIconic(_In_ HWND)
BOOL WINAPI FlashWindow(_In_ HWND, _In_ BOOL)
static LRESULT CALLBACK StartWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1771
#define E_FAIL
Definition: ddrawi.h:102
#define MEM_COMMIT
Definition: nt_native.h:1313
BOOL WINAPI DestroyWindow(_In_ HWND)
_AtlCreateWndData cd
Definition: atlwin.h:231
BOOL WINAPI SetWindowPlacement(_In_ HWND hWnd, _In_ const WINDOWPLACEMENT *)
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:58
BOOL ValidateRect(LPCRECT lpRect)
Definition: atlwin.h:1286
#define SetWindowLongPtr
Definition: treelist.c:70
POINTL point
Definition: edittest.c:50
HWND GetNextDlgTabItem(HWND hWndCtl, BOOL bPrevious=FALSE) const
Definition: atlwin.h:648
#define T
Definition: mbstring.h:31
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
void PrintClient(HDC hDC, DWORD dwFlags) const
Definition: atlwin.h:997
BOOL Init(WNDPROC proc, void *pThis)
Definition: atlwin.h:245
HWND WINAPI GetTopWindow(_In_opt_ HWND)
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1546
HFONT hFont
Definition: main.c:53
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define DWLP_MSGRESULT
Definition: winuser.h:864
_ATL_WNDCLASSINFOW CWndClassInfo
Definition: atlwin.h:64
struct ATL::CWindow::_IDHWNDPAIR * PIDHWNDPAIR
#define WM_PRINTCLIENT
Definition: richedit.h:70
const _ATL_MSG * m_pCurrentMsg
Definition: atlwin.h:1702
BOOL ResizeClient(int nWidth, int nHeight, BOOL bRedraw=FALSE)
Definition: atlwin.h:1015
HWND WINAPI GetLastActivePopup(_In_ HWND)
#define GetWindowText
Definition: winuser.h:5774
DWORD GetWindowContextHelpId() const
Definition: atlwin.h:726
BOOL WINAPI ScrollWindow(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT)
CWndProcThunk m_thunk
Definition: atlwin.h:1697
BOOL InvalidateRect(LPCRECT lpRect, BOOL bErase=TRUE)
Definition: atlwin.h:837
BOOL SetDlgItemText(int nID, LPCTSTR lpszString)
Definition: atlwin.h:1127
HWND WINAPI GetNextDlgGroupItem(_In_ HWND, _In_opt_ HWND, _In_ BOOL)
static BOOL CALLBACK GetDescendantWindowCallback(HWND hWnd, LPARAM lParam)
Definition: atlwin.h:531
int GetUpdateRgn(HRGN hRgn, BOOL bErase=FALSE)
Definition: atlwin.h:714
int WINAPI SetWindowRgn(_In_ HWND, _In_opt_ HRGN, _In_ BOOL)
int WINAPI GetDlgCtrlID(_In_ HWND)
void PrevDlgCtrl() const
Definition: atlwin.h:985
BOOL IsChild(const HWND hWnd) const
Definition: atlwin.h:849
BOOL SubclassWindow(HWND hWnd)
Definition: atlwin.h:1486
BOOL WINAPI ShowWindowAsync(_In_ HWND, _In_ int)
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:74
#define FALSE
Definition: types.h:117
HWND WINAPI SetActiveWindow(_In_ HWND)
HINSTANCE hInstance
Definition: winuser.h:3182
static DWORD GetWndStyle(DWORD dwStyle)
Definition: atlwin.h:1536
BOOL WINAPI HideCaret(_In_opt_ HWND)
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
void GotoDlgCtrl(HWND hWndCtrl) const
Definition: atlwin.h:813
BOOL WINAPI CreateCaret(_In_ HWND, _In_opt_ HBITMAP, _In_ int, _In_ int)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
int WINAPI GetUpdateRgn(_In_ HWND, _In_ HRGN, _In_ BOOL)
UINT_PTR SetTimer(UINT_PTR nIDEvent, UINT nElapse, void(CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD)=NULL)
Definition: atlwin.h:1193
BOOL CheckDlgButton(int nIDButton, UINT nCheck)
Definition: atlwin.h:335
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:507
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
LONG_PTR SetWindowLongPtr(int nIndex, LONG_PTR dwNewLong)
Definition: atlwin.h:1211
BOOL WINAPI SetWindowContextHelpId(_In_ HWND, _In_ DWORD)
BOOL CheckRadioButton(int nIDFirstButton, int nIDLastButton, int nIDCheckButton)
Definition: atlwin.h:341
BOOL WINAPI HiliteMenuItem(_In_ HWND, _In_ HMENU, _In_ UINT, _In_ UINT)
CWinTraits< WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, 0 > CControlWinTraits
Definition: atlwin.h:86
#define CreateWindowEx
Definition: winuser.h:5731
#define CW_USEDEFAULT
Definition: winuser.h:225
BOOL KillTimer(UINT_PTR nIDEvent)
Definition: atlwin.h:911
BOOL GetWindowRect(LPRECT lpRect) const
Definition: atlwin.h:764
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
BOOL WINAPI BringWindowToTop(_In_ HWND)
#define MAKELONG(a, b)
Definition: typedefs.h:249
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
BOOL SetMenu(HMENU hMenu)
Definition: atlwin.h:1157
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)
#define WM_GETFONT
Definition: winuser.h:1634
thunkCode * m_pthunk
Definition: atlwin.h:230
#define _In_
Definition: ms_sal.h:308
LONG_PTR LPARAM
Definition: windef.h:208
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
BOOL WINAPI IsWindowEnabled(_In_ HWND)
BOOL WINAPI IsWindowUnicode(_In_ HWND)
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
virtual DLGPROC GetDialogProc()
Definition: atlwin.h:1341
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
BOOL HideCaret()
Definition: atlwin.h:819
HWND GetDlgItem(int nID)
Definition: atlwin.h:571
#define PtrToUlong(u)
Definition: config.h:107
CContainedWindowT(CMessageMap *pObject, DWORD dwMsgMapID=0)
Definition: atlwin.h:1704
BOOL ClientToScreen(LPRECT lpRect) const
Definition: atlwin.h:365
CWinTraits< WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, WS_EX_APPWINDOW|WS_EX_WINDOWEDGE > CFrameWinTraits
Definition: atlwin.h:87
BOOL SetWindowPlacement(const WINDOWPLACEMENT *lpwndpl)
Definition: atlwin.h:1217
#define PostMessage
Definition: winuser.h:5808
void SendMessageToDescendants(UINT message, WPARAM wParam=0, LPARAM lParam=0, BOOL bDeep=TRUE)
Definition: atlwin.h:1078
#define DlgDirSelectEx
Definition: winuser.h:5745
int SetDlgCtrlID(int nID)
Definition: atlwin.h:1115
BOOL ValidateRgn(HRGN hRgn)
Definition: atlwin.h:1292
int ScrollWindowEx(int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate, UINT flags)
Definition: atlwin.h:1039
HMENU GetMenu() const
Definition: atlwin.h:636
BOOL ClientToScreen(LPPOINT lpPoint) const
Definition: atlwin.h:359
char TCHAR
Definition: xmlstorage.h:189
int DlgDirListComboBox(LPTSTR lpPathSpec, int nIDComboBox, int nIDStaticPath, UINT nFileType)
Definition: atlwin.h:452
Definition: rosdlgs.h:5
DWORD GetHotKey() const
Definition: atlwin.h:618
int SetWindowRgn(HRGN hRgn, BOOL bRedraw=FALSE)
Definition: atlwin.h:1229
#define _T(x)
Definition: vfdio.h:22
virtual void OnFinalMessage(HWND)
Definition: atlwin.h:1482
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define HELP_CONTEXT
Definition: winuser.h:2382
#define GetDlgItemText
Definition: winuser.h:5761
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HDC BeginPaint(LPPAINTSTRUCT lpPaint)
Definition: atlwin.h:297
TCHAR m_szAutoName[sizeof("ATL:")+sizeof(void *) *2]
Definition: atlwin.h:1955
LONG HRESULT
Definition: typedefs.h:79
_U_MENUorID(UINT nID)
Definition: atlwin.h:115
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
HWND Create(LPCTSTR lpstrWndClass, HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:383
#define SWP_NOACTIVATE
Definition: winuser.h:1228
BOOL EnableScrollBar(UINT uSBFlags, UINT uArrowFlags=ESB_ENABLE_BOTH)
Definition: atlwin.h:483
virtual ~CWindowImplRoot()
Definition: atlwin.h:1324
_ATL_MSG(HWND hWnd, UINT uMsg, WPARAM wParamIn, LPARAM lParamIn, BOOL bHandledIn=TRUE)
Definition: atlwin.h:142
#define RDW_ERASE
Definition: winuser.h:1197
BOOL GetWindowPlacement(WINDOWPLACEMENT *lpwndpl) const
Definition: atlwin.h:750
BOOL OpenClipboard()
Definition: atlwin.h:973
HDC GetWindowDC()
Definition: atlwin.h:732
int WINAPI GetScrollPos(_In_ HWND, _In_ int)
virtual WNDPROC GetWindowProc()
Definition: atlwin.h:1531
#define WM_NCDESTROY
Definition: winuser.h:1667
BOOL UpdateWindow()
Definition: atlwin.h:1280
int WINAPI GetWindowTextLengthW(_In_ HWND)
BOOL WINAPI ValidateRect(_In_opt_ HWND, _In_opt_ LPCRECT)
HWND SetClipboardViewer()
Definition: atlwin.h:1109
DWORD WINAPI GetWindowContextHelpId(_In_ HWND)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
BOOL CenterWindow(HWND hWndCenter=NULL)
Definition: atlwin.h:309
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT GetDlgItemInt(int nID, BOOL *lpTrans=NULL, BOOL bSigned=TRUE) const
Definition: atlwin.h:577
#define success(from, fromstr, to, tostr)
#define SetLastError(x)
Definition: compat.h:611
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define SetDlgItemText
Definition: winuser.h:5825
BOOL IsParentDialog()
Definition: atlwin.h:873
ATOM Register(WNDPROC *p)
Definition: atlwin.h:1957
#define WM_PRINT
Definition: winuser.h:1863
GLbitfield flags
Definition: glext.h:7161
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1722
HWND WINAPI ChildWindowFromPointEx(_In_ HWND, _In_ POINT, _In_ UINT)
BOOL DrawMenuBar()
Definition: atlwin.h:477
BOOL IsWindowUnicode()
Definition: atlwin.h:899
unsigned __int64 ULONG64
Definition: imports.h:198
BOOL WINAPI GetScrollInfo(_In_ HWND, _In_ int, _Inout_ LPSCROLLINFO)
#define DialogBoxParam
Definition: winuser.h:5740
LPRECT m_lpRect
Definition: atlwin.h:124
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
void SetRedraw(BOOL bRedraw=TRUE)
Definition: atlwin.h:1169
BOOL ScreenToClient(LPPOINT lpPoint) const
Definition: atlwin.h:1027
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
int GetWindowText(LPTSTR lpszStringBuf, int nMaxCount) const
Definition: atlwin.h:776
#define GetWindowLong
Definition: winuser.h:5772
BOOL SendNotifyMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1091
static BOOL bInvert
Definition: win.c:51
static DWORD GetWndExStyle(DWORD dwExStyle)
Definition: atlwin.h:99
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
BOOL ShowScrollBar(UINT nBar, BOOL bShow=TRUE)
Definition: atlwin.h:1262
BOOL CreateGrayCaret(int nWidth, int nHeight)
Definition: atlwin.h:410
static INT_PTR CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1364
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)
LONG GetWindowLong(int nIndex) const
Definition: atlwin.h:738
GLenum GLsizei len
Definition: glext.h:6722
BOOL LockWindowUpdate(BOOL bLock=TRUE)
Definition: atlwin.h:917
static LRESULT CALLBACK StartWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1554
BOOL CreateSolidCaret(int nWidth, int nHeight)
Definition: atlwin.h:416
HWND m_hWnd
Definition: atlwin.h:268
#define GetCurrentProcess()
Definition: compat.h:618
#define MessageBox
Definition: winuser.h:5798
BOOL ShowCaret()
Definition: atlwin.h:1250
BOOL DestroyWindow()
Definition: atlwin.h:428
UINT GetDlgItemText(int nID, LPTSTR lpStr, int nMaxCount) const
Definition: atlwin.h:583
BOOL SetWindowContextHelpId(DWORD dwContextHelpId)
Definition: atlwin.h:1199
void NextDlgCtrl() const
Definition: atlwin.h:967
CMessageMap * m_pObject
Definition: atlwin.h:1700
static LRESULT SendMessage(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1057
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
void Attach(HWND hWndNew)
Definition: atlwin.h:292
unsigned char BYTE
Definition: xxhash.c:193
int MapWindowPoints(HWND hWndTo, LPRECT lpRect) const
Definition: atlwin.h:931
WORD SetWindowWord(int nIndex, WORD wNewWord)
Definition: atlwin.h:1241
#define LoadCursor
Definition: winuser.h:5788
HWND Detach()
Definition: atlwin.h:439
#define GWLP_WNDPROC
Definition: treelist.c:66
BOOL IsIconic() const
Definition: atlwin.h:867
BOOL SubclassWindow(HWND hWnd)
Definition: atlwin.h:1727
static RECT rcDefault
Definition: atlwin.h:269
BOOL ShowOwnedPopups(BOOL bShow=TRUE)
Definition: atlwin.h:1256
int ReleaseDC(HDC hDC)
Definition: atlwin.h:1009
INT_PTR(CALLBACK * DLGPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2872
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define SWP_NOSIZE
Definition: winuser.h:1231
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2882
WORD GetWindowWord(int nIndex) const
Definition: atlwin.h:807
#define GWL_STYLE
Definition: winuser.h:846
CWndProcThunk m_thunk
Definition: atlwin.h:1314
_U_RECT(RECT &rc)
Definition: atlwin.h:131
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
WNDPROC m_pfnSuperWindowProc
Definition: atlwin.h:1699
int WINAPI SysReAllocStringLen(BSTR *old, const OLECHAR *str, unsigned int len)
Definition: oleaut.c:383
LONG_PTR GetWindowLongPtr(int nIndex) const
Definition: atlwin.h:744
HICON GetIcon(BOOL bBigIcon=TRUE) const
Definition: atlwin.h:624
HWND ChildWindowFromPoint(POINT point) const
Definition: atlwin.h:347
HWND WINAPI SetCapture(_In_ HWND hWnd)
BOOL WINAPI ShowOwnedPopups(_In_ HWND, _In_ BOOL)
HMENU GetSystemMenu(BOOL bRevert)
Definition: atlwin.h:684
HICON SetIcon(HICON hIcon, BOOL bBigIcon=TRUE)
Definition: atlwin.h:1151
_In_ BOOL bEnable
Definition: winddi.h:3426
WNDPROC m_pfnSuperWindowProc
Definition: atlwin.h:1474
BOOL IsZoomed() const
Definition: atlwin.h:905
static ATOM item
Definition: dde.c:856
HWND Create(HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle, _U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam)
Definition: atlwin.h:1621
int DlgDirList(LPTSTR lpPathSpec, int nIDListBox, int nIDStaticPath, UINT nFileType)
Definition: atlwin.h:446
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1268
BOOL PostMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:979
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
static BOOL CALLBACK SendMessageToDescendantsCallback(HWND hWnd, LPARAM lParam)
Definition: atlwin.h:1064
unsigned short USHORT
Definition: pedump.c:61
BOOL ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
Definition: atlwin.h:943
int GetDlgCtrlID() const
Definition: atlwin.h:559
HICON hIcon
Definition: msconfig.c:44
void Print(HDC hDC, DWORD dwFlags) const
Definition: atlwin.h:991
int SetHotKey(WORD wVirtualKeyCode, WORD wModifiers)
Definition: atlwin.h:1145
#define GCCU(x)
Definition: atlwin.h:27
BOOL GetDlgItemText(int nID, BSTR &bstrText) const
Definition: atlwin.h:600
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define SetWindowText
Definition: winuser.h:5833
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
HDC WINAPI GetWindowDC(_In_opt_ HWND)
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsZoomed(_In_ HWND)
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
HWND SetParent(HWND hWndNewParent)
Definition: atlwin.h:1163
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
#define RealGetWindowClass
Definition: winuser.h:5811
#define WM_SETFONT
Definition: winuser.h:1633
HWND UnsubclassWindow(BOOL bForce=FALSE)
Definition: atlwin.h:1750
BOOL WINAPI SetScrollRange(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ BOOL)
BOOL FlashWindow(BOOL bInvert)
Definition: atlwin.h:501
HDC GetDCEx(HRGN hRgnClip, DWORD flags)
Definition: atlwin.h:519
BOOL WINAPI IsChild(_In_ HWND, _In_ HWND)
LRESULT SendDlgItemMessage(int nID, UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1045
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
BOOL Invalidate(BOOL bErase=TRUE)
Definition: atlwin.h:831
HWND GetTopLevelParent() const
Definition: atlwin.h:690
#define msg(x)
Definition: auth_time.c:54
#define RDW_UPDATENOW
Definition: winuser.h:1206
static DWORD GetWndExStyle(DWORD dwExStyle)
Definition: atlwin.h:1541
_Out_opt_ int * cx
Definition: commctrl.h:585
#define MEM_RELEASE
Definition: nt_native.h:1316
__declspec(selectany) CAtlModule *_pAtlModule
Definition: atlbase.h:525
#define SendMessage
Definition: winuser.h:5819
BOOL SetDlgItemInt(int nID, UINT nValue, BOOL bSigned=TRUE)
Definition: atlwin.h:1121
HWND WINAPI ChildWindowFromPoint(_In_ HWND, _In_ POINT)
BOOL GetWindowText(BSTR &bstrText)
Definition: atlwin.h:782
static LPCTSTR GetWndCaption()
Definition: atlwin.h:1661
#define HIWORD(l)
Definition: typedefs.h:247
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1051
#define GetWindowTextLength
Definition: winuser.h:5775
BOOL WINAPI IsWindowVisible(_In_ HWND)
BOOL DlgDirSelectComboBox(LPTSTR lpString, int nCount, int nIDComboBox)
Definition: atlwin.h:464
HWND ChildWindowFromPointEx(POINT point, UINT uFlags) const
Definition: atlwin.h:353
static INT_PTR CALLBACK StartDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1346
LONG bottom
Definition: windef.h:309
BOOL WINAPI ShowCaret(_In_opt_ HWND)
void InvalidateRgn(HRGN hRgn, BOOL bErase=TRUE)
Definition: atlwin.h:843
#define SWP_NOMOVE
Definition: winuser.h:1230
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:128
static HBITMAP
Definition: button.c:44
_U_MENUorID(HMENU hMenu)
Definition: atlwin.h:110
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
static BOOL CALLBACK SendMessageToDescendantsCallbackDeep(HWND hWnd, LPARAM lParam)
Definition: atlwin.h:1070
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
int WINAPI GetWindowRgn(_In_ HWND, _In_ HRGN)
CWindow GetParent() const
Definition: atlwin.h:654
#define GetWindowLongPtr
Definition: treelist.c:73
BOOL WINAPI EnableScrollBar(_In_ HWND, _In_ UINT, _In_ UINT)
HDWP DeferWindowPos(HDWP hWinPosInfo, HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT uFlags)
Definition: atlwin.h:422
GLfloat GLfloat p
Definition: glext.h:8902
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
BOOL RedrawWindow(LPCRECT lpRectUpdate=NULL, HRGN hRgnUpdate=NULL, UINT flags=RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE)
Definition: atlwin.h:1003
LONG_PTR LRESULT
Definition: windef.h:209
int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption=NULL, UINT nType=MB_OK)
Definition: atlwin.h:937
BOOL bHandled
Definition: atlwin.h:140
HMENU WINAPI GetMenu(_In_ HWND)
BOOL CreateCaret(HBITMAP pBitmap)
Definition: atlwin.h:404
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
BOOL SetScrollRange(int nBar, int nMinPos, int nMaxPos, BOOL bRedraw=TRUE)
Definition: atlwin.h:1187
LPCTSTR m_lpszClassName
Definition: atlwin.h:1698
int WINAPI SetScrollPos(_In_ HWND, _In_ int, _In_ int, _In_ BOOL)
LPARAM lParam
Definition: combotst.c:139
_In_ int nMaxCount
Definition: winuser.h:4853
HWND WINAPI GetActiveWindow(void)
Definition: winpos.c:138
#define LOWORD(l)
Definition: pedump.c:82
int WINAPI SetScrollInfo(_In_ HWND, _In_ int, _In_ LPCSCROLLINFO, _In_ BOOL)
HDC GetDC()
Definition: atlwin.h:513
#define ESB_ENABLE_BOTH
Definition: winuser.h:563
BOOL GetScrollRange(int nBar, LPINT lpMinPos, LPINT lpMaxPos) const
Definition: atlwin.h:672
INT_PTR DoModal(HWND hWndParent=::GetActiveWindow(), LPARAM dwInitParam=NULL)
Definition: atlwin.h:1438
static DWORD GetWndExStyle(DWORD dwExStyle)
Definition: atlwin.h:78
#define SendNotifyMessage
Definition: winuser.h:5822
#define MAKEINTATOM(i)
Definition: winbase.h:1445
BOOL DestroyWindow()
Definition: atlwin.h:1458
HWND GetTopWindow() const
Definition: atlwin.h:702
HWND GetTopLevelWindow() const
Definition: atlwin.h:696
HWND SetCapture()
Definition: atlwin.h:1103
HWND SetActiveWindow()
Definition: atlwin.h:1097
const _ATL_MSG * m_pCurrentMsg
Definition: atlwin.h:1315
DWORD GetWindowProcessID()
Definition: atlwin.h:756
BOOL IsWindowVisible() const
Definition: atlwin.h:893
#define RDW_INVALIDATE
Definition: winuser.h:1200
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
BOOL BringWindowToTop()
Definition: atlwin.h:303
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1789
#define Unused(x)
Definition: atlwin.h:28
int * LPINT
Definition: windef.h:178
#define CreateDialogParam
Definition: winuser.h:5728
#define WinHelp
Definition: winuser.h:5840