Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / UIAutomation / UIAutomationClient / MS / Win32 / NativeMethods.cs / 1305600 / NativeMethods.cs
//****************************************************************************
// HOW TO USE THIS FILE
//
// If you need access to a Win32 API that is not exposed, simply uncomment
// it in one of the following files:
//
// NativeMethods.cs
// UnsafeNativeMethods.cs
// SafeNativeMethods.cs
//
// Only uncomment what you need to avoid code bloat.
//
// DO NOT adjust the visibility of anything in these files. They are marked
// internal on pupose.
//***************************************************************************
using System;
using System.Runtime.InteropServices;
namespace MS.Win32
{
internal static class NativeMethods
{
public const int MAX_PATH = 260;
// Dialog Codes
internal const int WM_GETDLGCODE = 0x0087;
internal const int DLGC_STATIC = 0x0100;
[StructLayout(LayoutKind.Sequential)]
public struct HWND
{
public IntPtr h;
public static HWND Cast(IntPtr h)
{
HWND hTemp = new HWND();
hTemp.h = h;
return hTemp;
}
public static implicit operator IntPtr(HWND h)
{
return h.h;
}
public static HWND NULL
{
get
{
HWND hTemp = new HWND();
hTemp.h = IntPtr.Zero;
return hTemp;
}
}
public static bool operator==(HWND hl, HWND hr)
{
return hl.h == hr.h;
}
public static bool operator!=(HWND hl, HWND hr)
{
return hl.h != hr.h;
}
override public bool Equals(object oCompare)
{
HWND hr = Cast((HWND)oCompare);
return h == hr.h;
}
public override int GetHashCode()
{
return (int) h;
}
}
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
public RECT(int left, int top, int right, int bottom)
{
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
public bool IsEmpty
{
get
{
return left >= right || top >= bottom;
}
}
}
[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
public int x;
public int y;
public POINT(int x, int y)
{
this.x = x;
this.y = y;
}
}
// WinEvent specific consts and delegates
public const int EVENT_MIN = 0;
public const int EVENT_MAX = 0x7FFFFFFF;
public const int EVENT_SYSTEM_MENUSTART = 0x0004;
public const int EVENT_SYSTEM_MENUEND = 0x0005;
public const int EVENT_SYSTEM_MENUPOPUPSTART = 0x0006;
public const int EVENT_SYSTEM_MENUPOPUPEND = 0x0007;
public const int EVENT_SYSTEM_CAPTURESTART = 0x0008;
public const int EVENT_SYSTEM_CAPTUREEND = 0x0009;
public const int EVENT_SYSTEM_SWITCHSTART = 0x0014;
public const int EVENT_SYSTEM_SWITCHEND = 0x0015;
public const int EVENT_OBJECT_CREATE = 0x8000;
public const int EVENT_OBJECT_DESTROY = 0x8001;
public const int EVENT_OBJECT_SHOW = 0x8002;
public const int EVENT_OBJECT_HIDE = 0x8003;
public const int EVENT_OBJECT_FOCUS = 0x8005;
public const int EVENT_OBJECT_STATECHANGE = 0x800A;
public const int EVENT_OBJECT_LOCATIONCHANGE = 0x800B;
public const int WINEVENT_OUTOFCONTEXT = 0x0000;
public const int WINEVENT_SKIPOWNTHREAD = 0x0001;
public const int WINEVENT_SKIPOWNPROCESS = 0x0002;
public const int WINEVENT_INCONTEXT = 0x0004;
// WinEvent fired when new Avalon UI is created
public const int EventObjectUIFragmentCreate = 0x6FFFFFFF;
// the delegate passed to USER for receiving a WinEvent
public delegate void WinEventProcDef(int winEventHook, int eventId, IntPtr hwnd, int idObject, int idChild, int eventThread, uint eventTime);
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//****************************************************************************
// HOW TO USE THIS FILE
//
// If you need access to a Win32 API that is not exposed, simply uncomment
// it in one of the following files:
//
// NativeMethods.cs
// UnsafeNativeMethods.cs
// SafeNativeMethods.cs
//
// Only uncomment what you need to avoid code bloat.
//
// DO NOT adjust the visibility of anything in these files. They are marked
// internal on pupose.
//***************************************************************************
using System;
using System.Runtime.InteropServices;
namespace MS.Win32
{
internal static class NativeMethods
{
public const int MAX_PATH = 260;
// Dialog Codes
internal const int WM_GETDLGCODE = 0x0087;
internal const int DLGC_STATIC = 0x0100;
[StructLayout(LayoutKind.Sequential)]
public struct HWND
{
public IntPtr h;
public static HWND Cast(IntPtr h)
{
HWND hTemp = new HWND();
hTemp.h = h;
return hTemp;
}
public static implicit operator IntPtr(HWND h)
{
return h.h;
}
public static HWND NULL
{
get
{
HWND hTemp = new HWND();
hTemp.h = IntPtr.Zero;
return hTemp;
}
}
public static bool operator==(HWND hl, HWND hr)
{
return hl.h == hr.h;
}
public static bool operator!=(HWND hl, HWND hr)
{
return hl.h != hr.h;
}
override public bool Equals(object oCompare)
{
HWND hr = Cast((HWND)oCompare);
return h == hr.h;
}
public override int GetHashCode()
{
return (int) h;
}
}
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
public RECT(int left, int top, int right, int bottom)
{
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
public bool IsEmpty
{
get
{
return left >= right || top >= bottom;
}
}
}
[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
public int x;
public int y;
public POINT(int x, int y)
{
this.x = x;
this.y = y;
}
}
// WinEvent specific consts and delegates
public const int EVENT_MIN = 0;
public const int EVENT_MAX = 0x7FFFFFFF;
public const int EVENT_SYSTEM_MENUSTART = 0x0004;
public const int EVENT_SYSTEM_MENUEND = 0x0005;
public const int EVENT_SYSTEM_MENUPOPUPSTART = 0x0006;
public const int EVENT_SYSTEM_MENUPOPUPEND = 0x0007;
public const int EVENT_SYSTEM_CAPTURESTART = 0x0008;
public const int EVENT_SYSTEM_CAPTUREEND = 0x0009;
public const int EVENT_SYSTEM_SWITCHSTART = 0x0014;
public const int EVENT_SYSTEM_SWITCHEND = 0x0015;
public const int EVENT_OBJECT_CREATE = 0x8000;
public const int EVENT_OBJECT_DESTROY = 0x8001;
public const int EVENT_OBJECT_SHOW = 0x8002;
public const int EVENT_OBJECT_HIDE = 0x8003;
public const int EVENT_OBJECT_FOCUS = 0x8005;
public const int EVENT_OBJECT_STATECHANGE = 0x800A;
public const int EVENT_OBJECT_LOCATIONCHANGE = 0x800B;
public const int WINEVENT_OUTOFCONTEXT = 0x0000;
public const int WINEVENT_SKIPOWNTHREAD = 0x0001;
public const int WINEVENT_SKIPOWNPROCESS = 0x0002;
public const int WINEVENT_INCONTEXT = 0x0004;
// WinEvent fired when new Avalon UI is created
public const int EventObjectUIFragmentCreate = 0x6FFFFFFF;
// the delegate passed to USER for receiving a WinEvent
public delegate void WinEventProcDef(int winEventHook, int eventId, IntPtr hwnd, int idObject, int idChild, int eventThread, uint eventTime);
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ThemeInfoAttribute.cs
- ProcessHostServerConfig.cs
- KeyFrames.cs
- TablePattern.cs
- RestHandler.cs
- XmlSyndicationContent.cs
- Icon.cs
- SafeProcessHandle.cs
- SynchronizedKeyedCollection.cs
- ExpandedProjectionNode.cs
- BitmapEffectGroup.cs
- XsltFunctions.cs
- GB18030Encoding.cs
- EnterpriseServicesHelper.cs
- AttributedMetaModel.cs
- MailWebEventProvider.cs
- Package.cs
- HttpListenerResponse.cs
- RotateTransform3D.cs
- CodeAccessSecurityEngine.cs
- ClipboardData.cs
- ZipIORawDataFileBlock.cs
- ErrorWrapper.cs
- HideDisabledControlAdapter.cs
- Variable.cs
- SystemDropShadowChrome.cs
- LayoutEngine.cs
- SqlEnums.cs
- BuildDependencySet.cs
- Point3DAnimationUsingKeyFrames.cs
- Rectangle.cs
- BooleanStorage.cs
- PageAsyncTaskManager.cs
- configsystem.cs
- Metafile.cs
- RowType.cs
- WindowsFormsSynchronizationContext.cs
- RSAPKCS1SignatureFormatter.cs
- SqlWorkflowInstanceStoreLock.cs
- MergeLocalizationDirectives.cs
- JsonByteArrayDataContract.cs
- DrawingGroupDrawingContext.cs
- RootBrowserWindowAutomationPeer.cs
- DrawingContextDrawingContextWalker.cs
- CheckBox.cs
- AssemblyResourceLoader.cs
- Version.cs
- DataFormat.cs
- ResourceReader.cs
- Stylesheet.cs
- PublisherMembershipCondition.cs
- Glyph.cs
- ChannelTokenTypeConverter.cs
- Span.cs
- UnsafeNetInfoNativeMethods.cs
- __TransparentProxy.cs
- CompilerParameters.cs
- ClientScriptManagerWrapper.cs
- CompilationUnit.cs
- keycontainerpermission.cs
- BasePattern.cs
- MaterialGroup.cs
- NetworkAddressChange.cs
- MaskInputRejectedEventArgs.cs
- PagedDataSource.cs
- MruCache.cs
- InputLanguageSource.cs
- FilterUserControlBase.cs
- Vector3DAnimationUsingKeyFrames.cs
- NetworkAddressChange.cs
- SchemaNames.cs
- CodeFieldReferenceExpression.cs
- UdpConstants.cs
- ErrorFormatter.cs
- ToggleProviderWrapper.cs
- XmlNodeList.cs
- FixedSOMPageConstructor.cs
- IntSecurity.cs
- BufferedWebEventProvider.cs
- SafeHandles.cs
- CacheEntry.cs
- RawAppCommandInputReport.cs
- sqlstateclientmanager.cs
- RawContentTypeMapper.cs
- DNS.cs
- UrlMappingsModule.cs
- ImportCatalogPart.cs
- Control.cs
- WsdlBuildProvider.cs
- FixedSOMTable.cs
- BuildProvidersCompiler.cs
- _ConnectStream.cs
- GeneralTransform3DGroup.cs
- SqlCharStream.cs
- DataSourceHelper.cs
- translator.cs
- TCEAdapterGenerator.cs
- VisualTarget.cs
- NetPeerTcpBindingElement.cs
- PreservationFileReader.cs