Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / WinForms / Managed / System / WinForms / ComponentModel / COM2Interop / OleStrCAMarshaler.cs / 1 / OleStrCAMarshaler.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.ComponentModel.Com2Interop { using System.Runtime.InteropServices; using System.ComponentModel; using System.Diagnostics; using System; ////// /// This class performs marshaling on a CALPOLESTR struct given /// from native code. /// internal class OleStrCAMarshaler: BaseCAMarshaler { public OleStrCAMarshaler(NativeMethods.CA_STRUCT caAddr) : base(caAddr) { } ////// /// Returns the type of item this marshaler will /// return in the items array. In this case, the type is string. /// public override Type ItemType { get { return typeof(string); } } protected override Array CreateArray() { return new string[Count]; } ////// /// Override this member to perform marshalling of a single item /// given it's native address. /// protected override object GetItemFromAddress(IntPtr addr) { string item = Marshal.PtrToStringUni(addr); // free the memory Marshal.FreeCoTaskMem(addr); return item; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.ComponentModel.Com2Interop { using System.Runtime.InteropServices; using System.ComponentModel; using System.Diagnostics; using System; ////// /// This class performs marshaling on a CALPOLESTR struct given /// from native code. /// internal class OleStrCAMarshaler: BaseCAMarshaler { public OleStrCAMarshaler(NativeMethods.CA_STRUCT caAddr) : base(caAddr) { } ////// /// Returns the type of item this marshaler will /// return in the items array. In this case, the type is string. /// public override Type ItemType { get { return typeof(string); } } protected override Array CreateArray() { return new string[Count]; } ////// /// Override this member to perform marshalling of a single item /// given it's native address. /// protected override object GetItemFromAddress(IntPtr addr) { string item = Marshal.PtrToStringUni(addr); // free the memory Marshal.FreeCoTaskMem(addr); return item; } } } // 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
- MutexSecurity.cs
- Cursors.cs
- NoneExcludedImageIndexConverter.cs
- ButtonField.cs
- IMembershipProvider.cs
- VirtualPathUtility.cs
- MemberRelationshipService.cs
- ISO2022Encoding.cs
- ICollection.cs
- ObjectHandle.cs
- safelinkcollection.cs
- XpsSerializationManager.cs
- Ops.cs
- HwndKeyboardInputProvider.cs
- MenuItemBinding.cs
- ReadOnlyTernaryTree.cs
- HttpCacheVary.cs
- SafeRightsManagementSessionHandle.cs
- CodeNamespaceCollection.cs
- NameObjectCollectionBase.cs
- JsonWriter.cs
- BrowserInteropHelper.cs
- FileDialog.cs
- SqlLiftIndependentRowExpressions.cs
- PageSetupDialog.cs
- Gdiplus.cs
- ClientRolePrincipal.cs
- MissingMemberException.cs
- GetWinFXPath.cs
- WebControl.cs
- ResourceReferenceExpression.cs
- LabelLiteral.cs
- WebPartCatalogAddVerb.cs
- DataSourceControlBuilder.cs
- WindowsBrush.cs
- DesignerActionUIService.cs
- RuntimeArgumentHandle.cs
- sitestring.cs
- VScrollProperties.cs
- CroppedBitmap.cs
- WebServiceFaultDesigner.cs
- DbResourceAllocator.cs
- WindowShowOrOpenTracker.cs
- WebPartConnectionCollection.cs
- TranslateTransform3D.cs
- DateTimeStorage.cs
- NativeMethods.cs
- BindingWorker.cs
- AnnotationObservableCollection.cs
- SiteMapDataSource.cs
- ServiceModelPerformanceCounters.cs
- TextRenderer.cs
- WizardStepBase.cs
- SequenceQuery.cs
- ReaderContextStackData.cs
- LogicalExpr.cs
- HostingEnvironment.cs
- DefaultBinder.cs
- WSHttpBindingBaseElement.cs
- ExtenderHelpers.cs
- HashMembershipCondition.cs
- GenerateScriptTypeAttribute.cs
- MatrixKeyFrameCollection.cs
- NotImplementedException.cs
- SimpleMailWebEventProvider.cs
- MbpInfo.cs
- HashCodeCombiner.cs
- TagNameToTypeMapper.cs
- Canvas.cs
- UnsafeNativeMethods.cs
- SizeConverter.cs
- MenuEventArgs.cs
- TableCellAutomationPeer.cs
- ContractCodeDomInfo.cs
- ColorContextHelper.cs
- ImageButton.cs
- SkewTransform.cs
- _ConnectOverlappedAsyncResult.cs
- XmlWhitespace.cs
- AttachInfo.cs
- Avt.cs
- X509IssuerSerialKeyIdentifierClause.cs
- NativeActivityMetadata.cs
- AppDomainUnloadedException.cs
- ToolStripItemCollection.cs
- StringBuilder.cs
- ReachUIElementCollectionSerializer.cs
- Avt.cs
- ListView.cs
- DataGridViewRowPostPaintEventArgs.cs
- DataChangedEventManager.cs
- Native.cs
- ColumnResizeUndoUnit.cs
- TypeContext.cs
- ToolStripPanelDesigner.cs
- DuplicateWaitObjectException.cs
- SecurityDescriptor.cs
- IntranetCredentialPolicy.cs
- DocumentXmlWriter.cs
- OutOfMemoryException.cs