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
- StyleSheetDesigner.cs
- tooltip.cs
- StyleConverter.cs
- DbConnectionOptions.cs
- FixedSOMTextRun.cs
- HttpHandler.cs
- IpcClientChannel.cs
- CSharpCodeProvider.cs
- ReferentialConstraint.cs
- grammarelement.cs
- DataGridPagerStyle.cs
- PerspectiveCamera.cs
- _NegotiateClient.cs
- SqlReferenceCollection.cs
- WindowsRebar.cs
- InkPresenterAutomationPeer.cs
- ResourcePart.cs
- LongValidatorAttribute.cs
- PropertyStore.cs
- DrawingGroup.cs
- LineGeometry.cs
- UInt32Storage.cs
- ToolStripProgressBar.cs
- CustomAttribute.cs
- ByteConverter.cs
- ReflectionPermission.cs
- ValueTypeFixupInfo.cs
- TextEditorCopyPaste.cs
- HttpWebResponse.cs
- IconConverter.cs
- DecoderExceptionFallback.cs
- MediaPlayerState.cs
- SyndicationContent.cs
- RequestCacheValidator.cs
- UIElementCollection.cs
- QueueException.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- TemplateInstanceAttribute.cs
- ConnectionOrientedTransportManager.cs
- WindowsEditBoxRange.cs
- FieldInfo.cs
- MouseCaptureWithinProperty.cs
- RegexWriter.cs
- HttpCookie.cs
- EntitySetBase.cs
- NavigationProperty.cs
- HwndAppCommandInputProvider.cs
- AsnEncodedData.cs
- Compensation.cs
- EFAssociationProvider.cs
- InputBinder.cs
- ToolStripItemCollection.cs
- Normalization.cs
- PenCursorManager.cs
- NavigationPropertyEmitter.cs
- QuerySubExprEliminator.cs
- HtmlInputHidden.cs
- ScrollProperties.cs
- BrowsableAttribute.cs
- GZipStream.cs
- EventMappingSettingsCollection.cs
- WebPartConnection.cs
- FormViewUpdatedEventArgs.cs
- RefreshResponseInfo.cs
- TransformPattern.cs
- VirtualPathUtility.cs
- AmbientLight.cs
- DispatcherExceptionFilterEventArgs.cs
- ViewBox.cs
- MappingException.cs
- CodeTypeReferenceCollection.cs
- DataGridToolTip.cs
- EncoderNLS.cs
- AutoSizeComboBox.cs
- FormClosedEvent.cs
- IPipelineRuntime.cs
- TextTreePropertyUndoUnit.cs
- EnvironmentPermission.cs
- ButtonPopupAdapter.cs
- HandlerBase.cs
- Matrix.cs
- RemotingConfigParser.cs
- UserControlBuildProvider.cs
- Itemizer.cs
- LowerCaseStringConverter.cs
- ParallelDesigner.xaml.cs
- MatrixKeyFrameCollection.cs
- oledbmetadatacollectionnames.cs
- MethodExpression.cs
- Classification.cs
- GridToolTip.cs
- SplayTreeNode.cs
- ServiceDescriptions.cs
- BindingEditor.xaml.cs
- RegexCompilationInfo.cs
- HitTestParameters.cs
- Guid.cs
- SoapMessage.cs
- DataGridViewSelectedRowCollection.cs
- MappingModelBuildProvider.cs