Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / Message.cs / 1305376 / Message.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms { using System.Text; using System.Runtime.InteropServices; using System.Runtime.Remoting; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Security; using System.Security.Permissions; using System; using System.Windows.Forms; ////// /// [SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)] [SuppressMessage("Microsoft.Security", "CA2108:ReviewDeclarativeSecurityOnValueTypes")] public struct Message { #if DEBUG static TraceSwitch AllWinMessages = new TraceSwitch("AllWinMessages", "Output every received message"); #endif IntPtr hWnd; int msg; IntPtr wparam; IntPtr lparam; IntPtr result; ////// Implements a Windows message. ////// /// public IntPtr HWnd { get { return hWnd; } set { hWnd = value; } } ///Specifies the window handle of the message. ////// /// public int Msg { get { return msg; } set { msg = value; } } ///Specifies the ID number for the message. ////// /// public IntPtr WParam { get { return wparam; } set { wparam = value; } } ///Specifies the ///of the message. /// /// public IntPtr LParam { get { return lparam; } set { lparam = value; } } ///Specifies the ///of the message. /// /// public IntPtr Result { get { return result; } set { result = value; } } ///Specifies the return value of the message. ////// /// public object GetLParam(Type cls) { return UnsafeNativeMethods.PtrToStructure(lparam, cls); } ///Gets the ///value, and converts the value to an object. /// /// public static Message Create(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam) { Message m = new Message(); m.hWnd = hWnd; m.msg = msg; m.wparam = wparam; m.lparam = lparam; m.result = IntPtr.Zero; #if DEBUG if(AllWinMessages.TraceVerbose) { Debug.WriteLine(m.ToString()); } #endif return m; } ///Creates a new ///object. public override bool Equals(object o) { if (!(o is Message)) { return false; } Message m = (Message)o; return hWnd == m.hWnd && msg == m.msg && wparam == m.wparam && lparam == m.lparam && result == m.result; } public static bool operator !=(Message a, Message b) { return !a.Equals(b); } public static bool operator ==(Message a, Message b) { return a.Equals(b); } /// public override int GetHashCode() { return (int)hWnd << 4 | msg; } /// /// /// /// public override string ToString() { // ----URT : 151574. Link Demand on System.Windows.Forms.Message // fails to protect overriden methods. bool unrestricted = false; try { IntSecurity.UnmanagedCode.Demand(); unrestricted = true; } catch (SecurityException) { // eat the exception. } if (unrestricted) { return MessageDecoder.ToString(this); } else { return base.ToString(); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlCachedBuffer.cs
- GetCertificateRequest.cs
- ConfigurationValue.cs
- _NestedMultipleAsyncResult.cs
- RawUIStateInputReport.cs
- TemplateBamlTreeBuilder.cs
- ScriptReference.cs
- SafeNativeMethods.cs
- ClientSettings.cs
- WCFServiceClientProxyGenerator.cs
- XsltException.cs
- RowToParametersTransformer.cs
- DecimalAnimationBase.cs
- Point3D.cs
- Ref.cs
- FilterEventArgs.cs
- PageFunction.cs
- BulletDecorator.cs
- FormViewModeEventArgs.cs
- FlowDocumentView.cs
- TablePatternIdentifiers.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- RectangleF.cs
- FormViewRow.cs
- ChangeDirector.cs
- PrinterUnitConvert.cs
- MetaData.cs
- TogglePatternIdentifiers.cs
- DbParameterCollectionHelper.cs
- SocketAddress.cs
- DataConnectionHelper.cs
- AssertUtility.cs
- ChangePassword.cs
- FontEmbeddingManager.cs
- TemplateParser.cs
- Int32Collection.cs
- HtmlElementEventArgs.cs
- Evidence.cs
- SystemTcpStatistics.cs
- CodeSubDirectoriesCollection.cs
- BinaryFormatterWriter.cs
- SharedPersonalizationStateInfo.cs
- HttpCookie.cs
- RSACryptoServiceProvider.cs
- CodeTypeOfExpression.cs
- Package.cs
- Section.cs
- EdgeModeValidation.cs
- SQLDouble.cs
- BinaryObjectInfo.cs
- WebServiceReceiveDesigner.cs
- TreeNodeMouseHoverEvent.cs
- LongValidatorAttribute.cs
- MediaTimeline.cs
- RuntimeArgumentHandle.cs
- BindingFormattingDialog.cs
- StackBuilderSink.cs
- SafeHandles.cs
- IPipelineRuntime.cs
- CodeEntryPointMethod.cs
- DataGridViewRowConverter.cs
- DeviceContexts.cs
- ApplicationTrust.cs
- GrowingArray.cs
- TextCompositionManager.cs
- StorageAssociationTypeMapping.cs
- InvalidDataException.cs
- SkipQueryOptionExpression.cs
- DateTimeConverter2.cs
- SingleQueryOperator.cs
- NullableConverter.cs
- WebPartActionVerb.cs
- GrammarBuilderPhrase.cs
- CompModSwitches.cs
- Pts.cs
- Renderer.cs
- ReferenceEqualityComparer.cs
- XamlSerializerUtil.cs
- HashJoinQueryOperatorEnumerator.cs
- LayoutUtils.cs
- FindCriteriaCD1.cs
- Processor.cs
- ProcessInputEventArgs.cs
- ExceptionHelpers.cs
- StreamHelper.cs
- CacheOutputQuery.cs
- AttachedPropertyMethodSelector.cs
- Int32.cs
- WindowsRebar.cs
- FormViewDesigner.cs
- x509store.cs
- XmlQueryContext.cs
- TypeLibConverter.cs
- LogExtent.cs
- CommonDialog.cs
- XmlSchemaParticle.cs
- AttachedPropertyInfo.cs
- PkcsUtils.cs
- RotateTransform3D.cs
- SiteMembershipCondition.cs