Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / System / Design / SafeNativeMethods.cs / 2 / SafeNativeMethods.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Design { using System.Runtime.InteropServices; using System; using System.Security.Permissions; using System.Collections; using System.IO; using System.Text; [ System.Security.SuppressUnmanagedCodeSecurityAttribute() ] internal static class SafeNativeMethods { [DllImport(ExternDll.Gdi32, SetLastError=true, ExactSpelling=true, EntryPoint="DeleteObject", CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern bool DeleteObject(HandleRef hObject); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern int GetMessagePos(); [DllImport(ExternDll.User32, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern int RegisterWindowMessage(string msg); [DllImport(ExternDll.Gdi32, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern bool GetTextMetrics(HandleRef hdc, NativeMethods.TEXTMETRIC tm); [DllImport(ExternDll.Gdi32, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern bool BitBlt(IntPtr hDC,int x,int y,int nWidth,int nHeight,IntPtr hSrcDC,int xSrc,int ySrc,int dwRop); [DllImport(ExternDll.Gdi32, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern IntPtr CreateSolidBrush(int crColor); [DllImport(ExternDll.User32, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern int GetWindowTextLength(HandleRef hWnd); [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern int GetTickCount(); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern bool RedrawWindow(IntPtr hwnd, NativeMethods.COMRECT rcUpdate, IntPtr hrgnUpdate, int flags); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, int flags); [DllImport(ExternDll.User32, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern int DrawText(HandleRef hDC, string lpszString, int nCount, ref NativeMethods.RECT lpRect, int nFormat); [DllImport(ExternDll.Gdi32, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern IntPtr SelectObject(HandleRef hDC, HandleRef hObject); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public extern static bool IsChild(HandleRef parent, HandleRef child); // this is a wrapper that comctl exposes for the NT function since it doesn't exist natively on 95. [DllImport(ExternDll.Comctl32, ExactSpelling=true)] private static extern bool _TrackMouseEvent(NativeMethods.TRACKMOUSEEVENT tme); public static bool TrackMouseEvent(NativeMethods.TRACKMOUSEEVENT tme) { // only on NT - not on 95 - comctl32 has a wrapper for 95 and NT. return _TrackMouseEvent(tme); } [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern int GetCurrentProcessId(); [DllImport(ExternDll.Gdi32, ExactSpelling=true, CharSet=CharSet.Auto)] public static extern bool RoundRect(HandleRef hDC, int left, int top, int right, int bottom, int width, int height); [DllImport(ExternDll.Gdi32, ExactSpelling=true, CharSet=CharSet.Auto)] public static extern bool Rectangle(HandleRef hdc, int left, int top, int right, int bottom); [DllImport(ExternDll.Gdi32, ExactSpelling=true, EntryPoint="CreatePen", CharSet=System.Runtime.InteropServices.CharSet.Auto)] private static extern IntPtr IntCreatePen(int nStyle, int nWidth, int crColor); public static IntPtr CreatePen(int nStyle, int nWidth, int crColor) { return System.Internal.HandleCollector.Add(IntCreatePen(nStyle, nWidth, crColor), NativeMethods.CommonHandles.GDI); } //--------Added because of VSWhidbey 581670----------------------------------------------------- // Investigate removing this if the duplicate code in OleDragDropHandler.cs is removed [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)] public static extern int SetROP2(HandleRef hDC, int nDrawMode); [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)] public static extern int SetBkColor(HandleRef hDC, int clr); //--------Added because of VSWhidbey 581670----------------------------------------------------- //[....] Nov 1, 2004: Removed /* [DllImport(ExternDll.Gdi32, ExactSpelling=true, CharSet=CharSet.Auto)] public static extern bool Ellipse(HandleRef hDC, int left, int top, int right, int bottom); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)] public static extern IntPtr GetSysColorBrush(int nIndex); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern bool MessageBeep(int type); [DllImport(ExternDll.User32, ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Auto)] public static extern bool RedrawWindow(IntPtr hwnd, ref NativeMethods.RECT rcUpdate, IntPtr hrgnUpdate, int flags); */ } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ParagraphResult.cs
- LinkUtilities.cs
- WindowsSecurityTokenAuthenticator.cs
- IListConverters.cs
- MetadataArtifactLoaderCompositeResource.cs
- XPathNavigatorKeyComparer.cs
- DesignerObjectListAdapter.cs
- RelationshipEndMember.cs
- SystemResources.cs
- Int64Animation.cs
- PenContext.cs
- ExecutionContext.cs
- PhonemeEventArgs.cs
- TextChangedEventArgs.cs
- VisualCollection.cs
- TdsRecordBufferSetter.cs
- ArglessEventHandlerProxy.cs
- FixedSOMSemanticBox.cs
- BStrWrapper.cs
- SearchForVirtualItemEventArgs.cs
- ColumnWidthChangedEvent.cs
- SqlClientMetaDataCollectionNames.cs
- StringPropertyBuilder.cs
- InputProviderSite.cs
- HtmlTableRow.cs
- CopyNodeSetAction.cs
- ClipboardProcessor.cs
- ByteAnimationUsingKeyFrames.cs
- ContextCorrelationInitializer.cs
- TripleDESCryptoServiceProvider.cs
- GridViewRow.cs
- TypeSystemHelpers.cs
- ConfigurationManagerHelperFactory.cs
- XPathAncestorQuery.cs
- OptimizedTemplateContent.cs
- SQLInt64.cs
- WindowsTreeView.cs
- SchemaNamespaceManager.cs
- XslAstAnalyzer.cs
- AccessDataSourceView.cs
- XPathException.cs
- DataGridViewCellValueEventArgs.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- XpsLiterals.cs
- TextTreeRootNode.cs
- StylusCollection.cs
- XmlHierarchicalDataSourceView.cs
- XPathScanner.cs
- IPAddress.cs
- RowSpanVector.cs
- TypeConverterMarkupExtension.cs
- ToolStripPanelRenderEventArgs.cs
- ScriptManagerProxy.cs
- DataGridColumn.cs
- _ProxyRegBlob.cs
- InitializationEventAttribute.cs
- Soap.cs
- UnsafeNativeMethodsPenimc.cs
- ImplicitInputBrush.cs
- OLEDB_Util.cs
- TextServicesDisplayAttributePropertyRanges.cs
- VisemeEventArgs.cs
- PerformanceCounterPermissionAttribute.cs
- AppSettingsSection.cs
- TemplateBuilder.cs
- MimeParameterWriter.cs
- MethodBody.cs
- GenerateTemporaryTargetAssembly.cs
- ViewStateModeByIdAttribute.cs
- GenericsInstances.cs
- DocumentCollection.cs
- CacheVirtualItemsEvent.cs
- WebPartZone.cs
- _SafeNetHandles.cs
- PerspectiveCamera.cs
- VisualCollection.cs
- SpinLock.cs
- ComboBoxItem.cs
- Operator.cs
- TraceLevelStore.cs
- HttpResponseInternalBase.cs
- ConsumerConnectionPointCollection.cs
- Soap.cs
- EmptyEnumerator.cs
- DrawingContextWalker.cs
- LinqDataSourceStatusEventArgs.cs
- ScaleTransform.cs
- EdmPropertyAttribute.cs
- HttpResponseInternalWrapper.cs
- MaterialCollection.cs
- WsdlImporterElementCollection.cs
- FixedSOMElement.cs
- DrawingCollection.cs
- Model3DGroup.cs
- SqlFileStream.cs
- CultureInfo.cs
- XmlSchemaObject.cs
- TextSerializer.cs
- BasicBrowserDialog.designer.cs
- MoveSizeWinEventHandler.cs