Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / WinFormsIntegration / MS / Win32 / UnsafeNativeMethods.cs / 1 / UnsafeNativeMethods.cs
using System; using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; namespace MS.Win32 { internal static class UnsafeNativeMethods { [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] public static extern bool IsChild(IntPtr hWndParent, IntPtr hwnd); [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] public static extern IntPtr GetFocus(); [DllImport("User32", ExactSpelling = true, CharSet = CharSet.Auto)] internal static extern IntPtr SetParent(IntPtr hWnd, IntPtr hWndParent); [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool TranslateMessage([In, Out] ref System.Windows.Interop.MSG msg); [DllImport(ExternDll.User32, CharSet = CharSet.Auto)] public static extern IntPtr DispatchMessage([In] ref System.Windows.Interop.MSG msg); [DllImport(ExternDll.User32, CharSet = CharSet.Auto, SetLastError = true)] internal static extern IntPtr SendMessage(HandleRef hWnd, int msg, IntPtr wParam, IntPtr lParam); [DllImport(ExternDll.Gdi32, ExactSpelling = true, CharSet = CharSet.Auto)] public static extern int GetDeviceCaps(DCSafeHandle hDC, int nIndex); [DllImport(ExternDll.Gdi32, EntryPoint = "CreateDC", CharSet = CharSet.Auto)] private static extern DCSafeHandle IntCreateDC(string lpszDriver, string lpszDeviceName, string lpszOutput, IntPtr devMode); public static DCSafeHandle CreateDC(string lpszDriver) { return IntCreateDC(lpszDriver, null, null, IntPtr.Zero); } [DllImport(ExternDll.Gdi32, ExactSpelling = true, CharSet = CharSet.Auto)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static extern bool DeleteDC(IntPtr hDC); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; namespace MS.Win32 { internal static class UnsafeNativeMethods { [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] public static extern bool IsChild(IntPtr hWndParent, IntPtr hwnd); [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] public static extern IntPtr GetFocus(); [DllImport("User32", ExactSpelling = true, CharSet = CharSet.Auto)] internal static extern IntPtr SetParent(IntPtr hWnd, IntPtr hWndParent); [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool TranslateMessage([In, Out] ref System.Windows.Interop.MSG msg); [DllImport(ExternDll.User32, CharSet = CharSet.Auto)] public static extern IntPtr DispatchMessage([In] ref System.Windows.Interop.MSG msg); [DllImport(ExternDll.User32, CharSet = CharSet.Auto, SetLastError = true)] internal static extern IntPtr SendMessage(HandleRef hWnd, int msg, IntPtr wParam, IntPtr lParam); [DllImport(ExternDll.Gdi32, ExactSpelling = true, CharSet = CharSet.Auto)] public static extern int GetDeviceCaps(DCSafeHandle hDC, int nIndex); [DllImport(ExternDll.Gdi32, EntryPoint = "CreateDC", CharSet = CharSet.Auto)] private static extern DCSafeHandle IntCreateDC(string lpszDriver, string lpszDeviceName, string lpszOutput, IntPtr devMode); public static DCSafeHandle CreateDC(string lpszDriver) { return IntCreateDC(lpszDriver, null, null, IntPtr.Zero); } [DllImport(ExternDll.Gdi32, ExactSpelling = true, CharSet = CharSet.Auto)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static extern bool DeleteDC(IntPtr hDC); } } // 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
- ResourceWriter.cs
- DataColumnCollection.cs
- InstallerTypeAttribute.cs
- SQLBoolean.cs
- PasswordTextNavigator.cs
- PropertyConverter.cs
- SystemParameters.cs
- FacetEnabledSchemaElement.cs
- WindowsFont.cs
- DataMemberConverter.cs
- FileLoadException.cs
- HtmlInputCheckBox.cs
- KnownAssembliesSet.cs
- ProxyGenerator.cs
- MarkupExtensionParser.cs
- GeometryCollection.cs
- RegexInterpreter.cs
- infer.cs
- DrawingState.cs
- EntityDataSourceValidationException.cs
- FormViewRow.cs
- JsonReaderWriterFactory.cs
- QualifierSet.cs
- FunctionImportElement.cs
- RequiredAttributeAttribute.cs
- DataContractSerializer.cs
- XamlPoint3DCollectionSerializer.cs
- Int32CollectionConverter.cs
- SafeSecurityHelper.cs
- ResXBuildProvider.cs
- DataGridToolTip.cs
- CategoryGridEntry.cs
- DocumentGrid.cs
- SdlChannelSink.cs
- MonthCalendarDesigner.cs
- EntityDataSourceValidationException.cs
- CodeDomDecompiler.cs
- SafeTimerHandle.cs
- SendKeys.cs
- PeerMaintainer.cs
- DataGridTextBoxColumn.cs
- Assert.cs
- HashHelper.cs
- EncoderExceptionFallback.cs
- DictionarySectionHandler.cs
- Encoder.cs
- TextMetrics.cs
- ContextMenuStrip.cs
- PrimitiveXmlSerializers.cs
- Decimal.cs
- XmlSchemaValidator.cs
- MultiDataTrigger.cs
- ProcessHostConfigUtils.cs
- SymmetricAlgorithm.cs
- TreeWalker.cs
- ParameterModifier.cs
- safelinkcollection.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- ChannelSinkStacks.cs
- Point4D.cs
- BinaryObjectInfo.cs
- X509PeerCertificateElement.cs
- SqlEnums.cs
- WebBrowser.cs
- OutKeywords.cs
- ToolStripDropDown.cs
- DoubleAnimationUsingKeyFrames.cs
- LoadRetryConstantStrategy.cs
- BooleanAnimationBase.cs
- base64Transforms.cs
- SafeLibraryHandle.cs
- TraceXPathNavigator.cs
- OleDragDropHandler.cs
- ArraySet.cs
- BooleanExpr.cs
- BaseTypeViewSchema.cs
- VoiceInfo.cs
- BasicAsyncResult.cs
- XamlWriter.cs
- VectorKeyFrameCollection.cs
- SafeViewOfFileHandle.cs
- ButtonChrome.cs
- FilteredAttributeCollection.cs
- RoutedEventValueSerializer.cs
- GridViewCellAutomationPeer.cs
- DefaultWorkflowLoaderService.cs
- UITypeEditor.cs
- EmptyControlCollection.cs
- NonClientArea.cs
- DocumentReference.cs
- PasswordTextNavigator.cs
- DataGridViewAutoSizeModeEventArgs.cs
- ActionNotSupportedException.cs
- ParenthesizePropertyNameAttribute.cs
- StandardOleMarshalObject.cs
- ServiceOperation.cs
- ListViewInsertedEventArgs.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- PartitionedDataSource.cs
- ElementProxy.cs