Source code of Windows XP (NT5)
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.

44 lines
938 B

  1. #ifndef __d6fae41e_2973_4474_bd22_af0773f51969__
  2. #define __d6fae41e_2973_4474_bd22_af0773f51969__
  3. #include "precomp.h"
  4. #include <tchar.h>
  5. BOOL CALLBACK EnumWindowsProc(HWND hwnd, // handle to parent window
  6. LPARAM lParam // application-defined value
  7. )
  8. {
  9. BOOL iRet = FALSE;
  10. if(hwnd && lParam)
  11. {
  12. TCHAR pBuffer[255] = {0};
  13. if(0 == GetClassName(hwnd,(TCHAR*)&pBuffer,255))
  14. {
  15. if(!_tcscmp(pBuffer,MAIN_WINDOW_CLASSNAME))
  16. {
  17. *((bool*)lParam) = true;
  18. }
  19. iRet = TRUE;
  20. }
  21. }
  22. return iRet;
  23. }
  24. class CFindInstance
  25. {
  26. public:
  27. CFindInstance()
  28. {
  29. }
  30. ~CFindInstance()
  31. {
  32. }
  33. bool CFindInstance::FindInstance(LPTSTR pWindowClass)
  34. {
  35. bool bInstanceFound = false;
  36. EnumWindows(&EnumWindowsProc,(LPARAM)&bInstanceFound);
  37. return bInstanceFound;
  38. }
  39. };
  40. #endif