Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / ComponentModel / COM2Interop / OleStrCAMarshaler.cs / 1305376 / 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
- AmbiguousMatchException.cs
- GraphicsState.cs
- TextBox.cs
- sqlnorm.cs
- InvalidCardException.cs
- DeferredTextReference.cs
- CustomCategoryAttribute.cs
- FixedDocumentPaginator.cs
- BamlLocalizableResource.cs
- EventLog.cs
- EventPrivateKey.cs
- MemberNameValidator.cs
- ConfigurationManagerHelperFactory.cs
- ConfigXmlWhitespace.cs
- DBSqlParser.cs
- SQLDateTimeStorage.cs
- NativeMethods.cs
- TraceHandlerErrorFormatter.cs
- Material.cs
- TextServicesCompartment.cs
- FormClosedEvent.cs
- ForwardPositionQuery.cs
- XmlElementCollection.cs
- SQLDouble.cs
- TemplatedMailWebEventProvider.cs
- SchemaAttDef.cs
- XPathScanner.cs
- OverrideMode.cs
- SingleSelectRootGridEntry.cs
- OleDbRowUpdatingEvent.cs
- ArgIterator.cs
- StreamInfo.cs
- OptimisticConcurrencyException.cs
- listitem.cs
- ResolveNameEventArgs.cs
- FieldNameLookup.cs
- ProcessHostFactoryHelper.cs
- SchemaTypeEmitter.cs
- QilIterator.cs
- Vertex.cs
- ObjectIDGenerator.cs
- UserPreferenceChangingEventArgs.cs
- RootNamespaceAttribute.cs
- ChannelCacheDefaults.cs
- BooleanAnimationBase.cs
- LayoutTable.cs
- COSERVERINFO.cs
- Thickness.cs
- DiscoveryDocumentSearchPattern.cs
- AssemblyCollection.cs
- ToolStripDropDownButton.cs
- CompilerScopeManager.cs
- ScopedMessagePartSpecification.cs
- MetadataItem_Static.cs
- Assembly.cs
- FixedSOMGroup.cs
- DescendantOverDescendantQuery.cs
- Int16KeyFrameCollection.cs
- SrgsDocument.cs
- DataBoundLiteralControl.cs
- RecordManager.cs
- InputMethodStateChangeEventArgs.cs
- CommentEmitter.cs
- ComNativeDescriptor.cs
- PermissionAttributes.cs
- WebColorConverter.cs
- UnsafeNativeMethodsTablet.cs
- ExecutionScope.cs
- AppearanceEditorPart.cs
- LinkButton.cs
- ModelPerspective.cs
- CultureSpecificStringDictionary.cs
- Run.cs
- DataListItemEventArgs.cs
- UnsafeNativeMethods.cs
- HelpOperationInvoker.cs
- ThreadAttributes.cs
- httpapplicationstate.cs
- Regex.cs
- DataViewManagerListItemTypeDescriptor.cs
- ICspAsymmetricAlgorithm.cs
- WebPartMenuStyle.cs
- CommandEventArgs.cs
- RegexCapture.cs
- EntityCodeGenerator.cs
- XmlAggregates.cs
- SimpleHandlerFactory.cs
- XmlTypeAttribute.cs
- HtmlHistory.cs
- CodeBlockBuilder.cs
- FormatterServicesNoSerializableCheck.cs
- EncryptedPackageFilter.cs
- Int32Animation.cs
- MasterPageCodeDomTreeGenerator.cs
- securitycriticaldata.cs
- TypeSystemHelpers.cs
- WindowsFormsSectionHandler.cs
- SetterBaseCollection.cs
- NameValueFileSectionHandler.cs
- CustomAttributeSerializer.cs