|
/*=============================================================================
*
* (C) Copyright 2007, Michael Carlisle (mike.carlisle@thecodeking.co.uk)
*
* http://www.TheCodeKing.co.uk
*
* All rights reserved.
* The code and information is provided "as-is" without waranty of any kind,
* either expresed or implied.
*
*-----------------------------------------------------------------------------
* History:
* 11/02/2007 Michael Carlisle Version 1.0
* 08/09/2007 Michael Carlisle Version 1.1
* 12/12/2009 Michael Carlisle Version 2.0
* Added XDIOStream implementation which can be used from Windows Services.
*=============================================================================
*/
using System;
using System.Diagnostics;
namespace TheCodeKing.Net.Messaging.Concrete.WindowsMessaging
{
/// <summary>
/// A class used as a WindowFilterHandler for the WindowsEnum class. This
/// filters the results of a windows enumeration based on whether the windows
/// contain a named property.
/// </summary>
internal sealed class WindowEnumFilter
{
/// <summary>
/// The property to search for when filtering the windows.
/// </summary>
private string property;
/// <summary>
/// The constructor which takes the property name used for filtering
/// results.
/// </summary>
/// <param name="property">The windows property name.</param>
public WindowEnumFilter(string property)
{
this.property = property;
}
/// <summary>
/// The delegate used to filter windows during emuneration. Only windows
/// that contain a named property are added to the enum.
/// </summary>
/// <param name="hWnd">The window being filtered.</param>
/// <param name="include">Indicates whether the window should be
/// inclused in the enumeration output.</param>
public void WindowFilterHandler(IntPtr hWnd, ref bool include)
{
Debug.WriteLine(">> "+hWnd);
if (Native.GetProp(hWnd, property) == 0)
include = false;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Mike Carlisle - Technical Architect with over 20 years experience in a wide range of technologies.
@TheCodeKing