Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.4 KiB

  1. //
  2. // shellwnd.h
  3. //
  4. #ifndef _SHELLWND_H_
  5. #define _SHELLWND_H_
  6. #include <shlapip.h>
  7. class CShellWndThread
  8. {
  9. public:
  10. CShellWndThread()
  11. {
  12. Clear();
  13. }
  14. void Clear()
  15. {
  16. _hwndTray = NULL;
  17. _hwndProgman = NULL;
  18. #ifdef LAYTER
  19. _dwThreadIdTray = 0;
  20. _dwThreadIdProgman = 0;
  21. #endif
  22. }
  23. HWND GetWndTray()
  24. {
  25. if (!_hwndTray || !IsWindow(_hwndTray))
  26. _hwndTray = FindWindow(TEXT(WNDCLASS_TRAYNOTIFY), NULL);
  27. return _hwndTray;
  28. }
  29. HWND GetWndProgman()
  30. {
  31. if (!_hwndProgman || !IsWindow(_hwndProgman))
  32. _hwndProgman = FindWindow("Progman", NULL);
  33. return _hwndProgman;
  34. }
  35. #ifdef LAYTER
  36. DWORD GetWndTrayThread()
  37. {
  38. if (!GetWndTray())
  39. _dwThreadIdTray = 0;
  40. else if (!_dwThreadIdTray)
  41. _dwThreadIdTray = GetWindowThreadProcessId(_hwndTray, NULL);
  42. return _dwThreadIdTray;
  43. }
  44. DWORD GetWndProgmanThread()
  45. {
  46. if (!GetWndProgman())
  47. _dwThreadIdProgman = 0;
  48. else if (!_dwThreadIdProgman)
  49. _dwThreadIdProgman = GetWindowThreadProcessId(_hwndProgman, NULL);
  50. return _dwThreadIdProgman;
  51. }
  52. #endif
  53. private:
  54. HWND _hwndTray;
  55. HWND _hwndProgman;
  56. #ifdef LAYTER
  57. DWORD _dwThreadIdTray;
  58. DWORD _dwThreadIdProgman;
  59. #endif
  60. };
  61. #endif _SHELLWND_H_