Initial
This commit is contained in:
59
hookproc/DesktopWindowEnumerator.hpp
Normal file
59
hookproc/DesktopWindowEnumerator.hpp
Normal file
@@ -0,0 +1,59 @@
|
||||
#ifndef _HOOKPROC_DESKTOPWINDOWENUMERATOR_HPP_
|
||||
#define _HOOKPROC_DESKTOPWINDOWENUMERATOR_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_BLOCK_HPP_
|
||||
#include <common/block.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_DESKTOP_HPP_
|
||||
#include <common/desktop.hpp>
|
||||
#endif
|
||||
#ifndef _HOOKPROC_ENUMWINDOWSHOOK_HPP_
|
||||
#include <hookproc/enumwin.hpp>
|
||||
#endif
|
||||
|
||||
class DesktopWindowEnumerator : public EnumWindowsHook, public Block<HWND>
|
||||
{
|
||||
public:
|
||||
DesktopWindowEnumerator();
|
||||
virtual ~DesktopWindowEnumerator();
|
||||
bool enumerateDesktopWindows(Desktop &desktop);
|
||||
DWORD size(void)const;
|
||||
protected:
|
||||
virtual bool enumWindowsProc(HWND hWnd,LPARAM lParam);
|
||||
private:
|
||||
};
|
||||
|
||||
inline
|
||||
DesktopWindowEnumerator::DesktopWindowEnumerator()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
DesktopWindowEnumerator::~DesktopWindowEnumerator()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
bool DesktopWindowEnumerator::enumerateDesktopWindows(Desktop &desktop)
|
||||
{
|
||||
Block<HWND>::remove();
|
||||
if(!desktop.isOkay())return false;
|
||||
::EnumDesktopWindows(desktop.getHandle(),(LPFNENUMWINDOWPROC)getHookAddress(),0L);
|
||||
return size()?true:false;
|
||||
}
|
||||
|
||||
inline
|
||||
bool DesktopWindowEnumerator::enumWindowsProc(HWND hWnd,LPARAM lParam)
|
||||
{
|
||||
Block<HWND>::insert(&hWnd);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline
|
||||
DWORD DesktopWindowEnumerator::size(void)const
|
||||
{
|
||||
return Block<HWND>::size();
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user