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
- SoapServerMethod.cs
- RequestSecurityTokenResponseCollection.cs
- InputMethodStateChangeEventArgs.cs
- AssemblyAttributes.cs
- HtmlTableRow.cs
- Control.cs
- CustomValidator.cs
- ModelPerspective.cs
- AppDomainUnloadedException.cs
- NetNamedPipeSecurity.cs
- MemberBinding.cs
- HostedHttpTransportManager.cs
- ContainerVisual.cs
- ConfigurationLocationCollection.cs
- DetailsViewModeEventArgs.cs
- ListViewSortEventArgs.cs
- DataTableClearEvent.cs
- MessageDescriptionCollection.cs
- XmlHierarchyData.cs
- Query.cs
- WebPartHeaderCloseVerb.cs
- TypeNameHelper.cs
- WindowsStartMenu.cs
- IndexerNameAttribute.cs
- WrapPanel.cs
- ErrorFormatterPage.cs
- DataBoundLiteralControl.cs
- SimpleMailWebEventProvider.cs
- PriorityItem.cs
- SmiContextFactory.cs
- Label.cs
- SqlError.cs
- KnownIds.cs
- SHA384.cs
- XmlToDatasetMap.cs
- InlineObject.cs
- ObjectCloneHelper.cs
- Convert.cs
- ITreeGenerator.cs
- COM2Enum.cs
- IdentityModelDictionary.cs
- AbandonedMutexException.cs
- StylusLogic.cs
- PreviewKeyDownEventArgs.cs
- ListView.cs
- TimeZone.cs
- ExecutionEngineException.cs
- ResizeBehavior.cs
- XmlILStorageConverter.cs
- PinnedBufferMemoryStream.cs
- WebContentFormatHelper.cs
- BigInt.cs
- RoutedEventArgs.cs
- OleDbConnectionInternal.cs
- ToolBarOverflowPanel.cs
- ECDiffieHellmanPublicKey.cs
- altserialization.cs
- assemblycache.cs
- DynamicResourceExtension.cs
- GlobalEventManager.cs
- PrintDialog.cs
- _TransmitFileOverlappedAsyncResult.cs
- Queue.cs
- CorrelationManager.cs
- BufferedGraphicsManager.cs
- SingleTagSectionHandler.cs
- MachinePropertyVariants.cs
- Hashtable.cs
- MimeObjectFactory.cs
- DPAPIProtectedConfigurationProvider.cs
- TranslateTransform.cs
- DataKeyPropertyAttribute.cs
- TemplateLookupAction.cs
- PermissionAttributes.cs
- EdmComplexTypeAttribute.cs
- AxHost.cs
- RemotingServices.cs
- Helpers.cs
- RectAnimationUsingKeyFrames.cs
- SplashScreen.cs
- Attribute.cs
- WSDualHttpSecurity.cs
- EntityObject.cs
- UInt64Converter.cs
- CapiSymmetricAlgorithm.cs
- Registry.cs
- SqlCommandSet.cs
- DispatcherExceptionEventArgs.cs
- TaskFormBase.cs
- ConstructorNeedsTagAttribute.cs
- EventLog.cs
- CodeTypeDeclaration.cs
- EnumDataContract.cs
- BitmapCacheBrush.cs
- WindowsSpinner.cs
- HttpCachePolicy.cs
- HMACSHA1.cs
- CriticalExceptions.cs
- CodeLabeledStatement.cs
- RootBrowserWindowAutomationPeer.cs