Changeset 1567
- Timestamp:
- 1/18/2010 6:49:46 AM (3 years ago)
- Location:
- branches/eraser6/CodeReview/Eraser.Util
- Files:
-
- 1 added
- 3 edited
-
ConsoleWindow.cs (added)
-
Eraser.Util.csproj (modified) (1 diff)
-
KernelApi.cs (modified) (1 diff)
-
NativeMethods/Kernel.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/CodeReview/Eraser.Util/Eraser.Util.csproj
r1565 r1567 82 82 </ItemGroup> 83 83 <ItemGroup> 84 <Compile Include="ConsoleWindow.cs" /> 84 85 <Compile Include="Power.cs" /> 85 86 <Compile Include="NativeMethods\Gdi.cs" /> -
branches/eraser6/CodeReview/Eraser.Util/KernelApi.cs
r1566 r1567 32 32 public static class KernelApi 33 33 { 34 /// <summary>35 /// Allocates a new console for the calling process.36 /// </summary>37 /// <returns>If the function succeeds, the return value is nonzero.38 ///39 /// If the function fails, the return value is zero. To get extended error40 /// information, call Marshal.GetLastWin32Error.</returns>41 /// <remarks>A process can be associated with only one console, so the AllocConsole42 /// function fails if the calling process already has a console. A process can43 /// use the FreeConsole function to detach itself from its current console, then44 /// it can call AllocConsole to create a new console or AttachConsole to attach45 /// to another console.46 ///47 /// If the calling process creates a child process, the child inherits the48 /// new console.49 ///50 /// AllocConsole initializes standard input, standard output, and standard error51 /// handles for the new console. The standard input handle is a handle to the52 /// console's input buffer, and the standard output and standard error handles53 /// are handles to the console's screen buffer. To retrieve these handles, use54 /// the GetStdHandle function.55 ///56 /// This function is primarily used by graphical user interface (GUI) application57 /// to create a console window. GUI applications are initialized without a58 /// console. Console applications are initialized with a console, unless they59 /// are created as detached processes (by calling the CreateProcess function60 /// with the DETACHED_PROCESS flag).</remarks>61 [Obsolete]62 public static bool AllocConsole()63 {64 return NativeMethods.AllocConsole();65 }66 67 /// <summary>68 /// Detaches the calling process from its console.69 /// </summary>70 /// <returns>If the function succeeds, the return value is nonzero.71 ///72 /// If the function fails, the return value is zero. To get extended error73 /// information, call Marshal.GetLastWin32Error.</returns>74 /// <remarks>A process can be attached to at most one console. If the calling75 /// process is not already attached to a console, the error code returned is76 /// ERROR_INVALID_PARAMETER (87).77 ///78 /// A process can use the FreeConsole function to detach itself from its79 /// console. If other processes share the console, the console is not destroyed,80 /// but the process that called FreeConsole cannot refer to it. A console is81 /// closed when the last process attached to it terminates or calls FreeConsole.82 /// After a process calls FreeConsole, it can call the AllocConsole function to83 /// create a new console or AttachConsole to attach to another console.</remarks>84 [Obsolete]85 public static bool FreeConsole()86 {87 return NativeMethods.FreeConsole();88 }89 90 34 /// <summary> 91 35 /// Retrieves the current value of the high-resolution performance counter. -
branches/eraser6/CodeReview/Eraser.Util/NativeMethods/Kernel.cs
r1544 r1567 260 260 } 261 261 262 /// <summary> 263 /// Allocates a new console for the calling process. 264 /// </summary> 265 /// <returns>If the function succeeds, the return value is nonzero. 266 /// 267 /// If the function fails, the return value is zero. To get extended error 268 /// information, call Marshal.GetLastWin32Error.</returns> 269 /// <remarks>A process can be associated with only one console, so the AllocConsole 270 /// function fails if the calling process already has a console. A process can 271 /// use the FreeConsole function to detach itself from its current console, then 272 /// it can call AllocConsole to create a new console or AttachConsole to attach 273 /// to another console. 274 /// 275 /// If the calling process creates a child process, the child inherits the 276 /// new console. 277 /// 278 /// AllocConsole initializes standard input, standard output, and standard error 279 /// handles for the new console. The standard input handle is a handle to the 280 /// console's input buffer, and the standard output and standard error handles 281 /// are handles to the console's screen buffer. To retrieve these handles, use 282 /// the GetStdHandle function. 283 /// 284 /// This function is primarily used by graphical user interface (GUI) application 285 /// to create a console window. GUI applications are initialized without a 286 /// console. Console applications are initialized with a console, unless they 287 /// are created as detached processes (by calling the CreateProcess function 288 /// with the DETACHED_PROCESS flag).</remarks> 262 289 [DllImport("Kernel32.dll", SetLastError = true)] 263 290 [return: MarshalAs(UnmanagedType.Bool)] 264 291 public static extern bool AllocConsole(); 265 292 293 /// <summary> 294 /// Detaches the calling process from its console. 295 /// </summary> 296 /// <returns>If the function succeeds, the return value is nonzero. 297 /// 298 /// If the function fails, the return value is zero. To get extended error 299 /// information, call Marshal.GetLastWin32Error.</returns> 300 /// <remarks>A process can be attached to at most one console. If the calling 301 /// process is not already attached to a console, the error code returned is 302 /// ERROR_INVALID_PARAMETER (87). 303 /// 304 /// A process can use the FreeConsole function to detach itself from its 305 /// console. If other processes share the console, the console is not destroyed, 306 /// but the process that called FreeConsole cannot refer to it. A console is 307 /// closed when the last process attached to it terminates or calls FreeConsole. 308 /// After a process calls FreeConsole, it can call the AllocConsole function to 309 /// create a new console or AttachConsole to attach to another console.</remarks> 266 310 [DllImport("Kernel32.dll", SetLastError = true)] 267 311 [return: MarshalAs(UnmanagedType.Bool)]
Note: See TracChangeset
for help on using the changeset viewer.
