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
- ListenUriMode.cs
- BitmapData.cs
- SafeProcessHandle.cs
- BaseTreeIterator.cs
- IconHelper.cs
- ListViewCancelEventArgs.cs
- SrgsRule.cs
- x509utils.cs
- ActiveXHelper.cs
- ModelUIElement3D.cs
- IDQuery.cs
- DocumentViewer.cs
- Ray3DHitTestResult.cs
- CannotUnloadAppDomainException.cs
- CatalogPartDesigner.cs
- GrammarBuilderDictation.cs
- StringUtil.cs
- WeakEventManager.cs
- Perspective.cs
- DocumentReferenceCollection.cs
- QuadTree.cs
- FlowchartDesigner.Helpers.cs
- COM2IProvidePropertyBuilderHandler.cs
- XmlRawWriter.cs
- RequestCacheManager.cs
- PackWebResponse.cs
- IssuedTokenServiceElement.cs
- SafeFileMappingHandle.cs
- FontSourceCollection.cs
- RichTextBoxAutomationPeer.cs
- SchemaNames.cs
- WaitHandleCannotBeOpenedException.cs
- AppDomainGrammarProxy.cs
- MasterPageParser.cs
- HuffmanTree.cs
- BoolLiteral.cs
- InfoCardTraceRecord.cs
- CustomErrorsSection.cs
- ListItemCollection.cs
- ReadOnlyHierarchicalDataSourceView.cs
- WindowsUpDown.cs
- QilFactory.cs
- XmlNotation.cs
- BlockCollection.cs
- SqlNode.cs
- TrackingProfileSerializer.cs
- FlowLayout.cs
- TextDecorations.cs
- DataServiceProcessingPipeline.cs
- DataProtection.cs
- UnionExpr.cs
- FtpWebRequest.cs
- Errors.cs
- XXXOnTypeBuilderInstantiation.cs
- basemetadatamappingvisitor.cs
- DocumentXmlWriter.cs
- Icon.cs
- ObjectSet.cs
- PolyBezierSegment.cs
- SqlFormatter.cs
- GridSplitterAutomationPeer.cs
- MouseOverProperty.cs
- ReachPrintTicketSerializer.cs
- ResXResourceReader.cs
- PageStatePersister.cs
- XmlILConstructAnalyzer.cs
- _AutoWebProxyScriptWrapper.cs
- BaseCAMarshaler.cs
- ConfigXmlWhitespace.cs
- TableDetailsRow.cs
- DbConnectionClosed.cs
- XPathNode.cs
- RadioButtonRenderer.cs
- StylusButton.cs
- FormsAuthenticationEventArgs.cs
- SymLanguageVendor.cs
- StreamReader.cs
- xml.cs
- ScopeCollection.cs
- DataGridCellsPanel.cs
- FileClassifier.cs
- Listbox.cs
- WindowsTooltip.cs
- WsdlBuildProvider.cs
- Exception.cs
- IxmlLineInfo.cs
- MatrixAnimationBase.cs
- RequestQueryParser.cs
- LayoutSettings.cs
- ClientScriptManager.cs
- StrongNameUtility.cs
- CodeRegionDirective.cs
- SplitterPanelDesigner.cs
- FolderNameEditor.cs
- InheritanceAttribute.cs
- StandardBindingElementCollection.cs
- NativeMethods.cs
- XmlSchemaSimpleTypeRestriction.cs
- ITextView.cs
- NameService.cs