Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ReferenceTypeElement.cs
- SqlNodeTypeOperators.cs
- HandlerFactoryCache.cs
- StatusBarDrawItemEvent.cs
- FontStretches.cs
- cookiecontainer.cs
- ViewStateException.cs
- GatewayIPAddressInformationCollection.cs
- Matrix3DStack.cs
- DefaultProxySection.cs
- SerializationTrace.cs
- MasterPage.cs
- DockProviderWrapper.cs
- XhtmlBasicPageAdapter.cs
- BuildProviderUtils.cs
- GrowingArray.cs
- ChangeProcessor.cs
- RawStylusInputCustomData.cs
- XhtmlConformanceSection.cs
- DependencyProperty.cs
- HMACMD5.cs
- OdbcConnection.cs
- RuleElement.cs
- handlecollector.cs
- InputReferenceExpression.cs
- ReaderWriterLockWrapper.cs
- DataSourceGroupCollection.cs
- PluralizationServiceUtil.cs
- ReliableOutputConnection.cs
- RSAOAEPKeyExchangeDeformatter.cs
- InkSerializer.cs
- SchemaElementLookUpTable.cs
- ObjectAnimationUsingKeyFrames.cs
- KeyedQueue.cs
- DocumentOrderQuery.cs
- TextTreeObjectNode.cs
- KeyValueSerializer.cs
- ProgressBar.cs
- CatalogPart.cs
- OdbcDataAdapter.cs
- InkCanvasSelection.cs
- XmlSchemaDocumentation.cs
- safemediahandle.cs
- TimeSpan.cs
- WindowHideOrCloseTracker.cs
- RijndaelManagedTransform.cs
- CharEnumerator.cs
- AnnouncementInnerClientCD1.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- GC.cs
- DirectoryInfo.cs
- CustomWebEventKey.cs
- MetadataArtifactLoaderFile.cs
- HttpDebugHandler.cs
- PowerEase.cs
- Main.cs
- DesignerWebPartChrome.cs
- ComplexTypeEmitter.cs
- SystemWebSectionGroup.cs
- ListViewGroup.cs
- DocumentOrderQuery.cs
- SystemSounds.cs
- Queue.cs
- DbLambda.cs
- ExcCanonicalXml.cs
- CallbackValidatorAttribute.cs
- DiscoveryService.cs
- TrustSection.cs
- MiniCustomAttributeInfo.cs
- DebugController.cs
- PropertyEntry.cs
- IndexerHelper.cs
- Attributes.cs
- ExclusiveHandle.cs
- DocumentXPathNavigator.cs
- SrgsElement.cs
- SafeHandles.cs
- BaseServiceProvider.cs
- ScrollEventArgs.cs
- ClientScriptManagerWrapper.cs
- OleDbInfoMessageEvent.cs
- GCHandleCookieTable.cs
- XamlFilter.cs
- SqlTypesSchemaImporter.cs
- EndSelectCardRequest.cs
- DataGridViewRowPostPaintEventArgs.cs
- ClientSponsor.cs
- CodeSnippetTypeMember.cs
- BitmapEffectOutputConnector.cs
- CombinedGeometry.cs
- DynamicQueryableWrapper.cs
- ProviderBase.cs
- HostingEnvironmentException.cs
- RegexCaptureCollection.cs
- LayoutSettings.cs
- CompilerResults.cs
- BrowserDefinition.cs
- InvokeCompletedEventArgs.cs
- ListItemCollection.cs
- DataGridState.cs