windows console命令模式俗称dos模式 那么 我曾经看到一种在dos模式下运行的服务器窗口,运行中的时候,提示信息末尾有个提示符按照 [\] - >[ ¦] - >[/] - >[-] 依次变换,进而形成转动的"动画"... 相信各位看到过吧? 试问这种"特效"是怎么实现的呢? 第二个问题是,在dos模式下运行的.Net程序,怎么像CS(反恐精英)服务器那样持续捕捉用户的输入呢?
好比一个服务器在运行,我直接输入 show user (回车) 直接可以看到查询结果...酱紫. 请赐教!感激万分.
好比一个服务器在运行,我直接输入 show user (回车) 直接可以看到查询结果...酱紫. 请赐教!感激万分.
解决方案 »
- 问个小问题,谢谢!
- 父类的数组存储子类的对象 怎么搞??
- 如何缩小或去掉listview details view 单元格内字符前后的空白
- "未将对象引用设置到对象的实例",这个问题怎么解决,急呀!
- 想问个问题 怎么做投票器呢。。。。
- Winform操作Word遇到80080005 服务器运行失败 (异常来自 HRESULT:0x80080005 (CO_E_SERVER_EXEC_FA
- 为什么Hashtable里的Item属性不见了???
- 在不同窗体的DataGrid之间怎么实现拖放?
- 如何清空如TextBox等以前输入的值?
- 在www.263.net经常看到在线游戏一些的东西,这些游戏是用JAVA写的。
- 这段代码我应该怎么改?关于转义符的问题
- 在script 里面如果给textbox控件附值
Module Module1
Dim ClearMyConsole As New ClearConsole
Sub Main()
Dim prgThread As New Threading.Thread(AddressOf Progress)
prgThread.Start()
Console.ReadLine()
End Sub Public Sub Progress()
While True
'\] - >[ ¦] - >[/] - >[-]
Console.Write("\")
CurrentThread.Sleep(200)
ClearMyConsole.Clear()
Console.Write("¦")
CurrentThread.Sleep(200)
ClearMyConsole.Clear()
Console.Write("/")
CurrentThread.Sleep(200)
ClearMyConsole.Clear()
Console.Write("-")
CurrentThread.Sleep(200)
ClearMyConsole.Clear()
End While
End Sub
End Module
-------------------------------------------------------------
This part below is from http://support.microsoft.com/default.aspx?scid=kb;en-us;319239
'How to clear the Console window with Visual Basic .NET or Visual Basic 2005
'Add to a class
Imports System.Runtime.InteropServicesPublic Class ClearConsole Private Const STD_OUTPUT_HANDLE As Integer = &HFFFFFFF5
Private Const EMPTY As Byte = 32 ' Structure defines the coordinates of a character cell in a console screen buffer.
' The origin of the coordinate system (0,0) is at the top-left cell of the buffer.
<StructLayout(LayoutKind.Sequential)> _
Structure COORD
Dim X As Short
Dim Y As Short
End Structure ' Structure defines the coordinates of the upper-left and lower-right corners of a rectangle
<StructLayout(LayoutKind.Sequential)> _
Structure SMALL_RECT
Dim Left As Short
Dim Top As Short
Dim Right As Short
Dim Bottom As Short
End Structure ' Structure containing information about the Console's screen buffer.
<StructLayout(LayoutKind.Sequential)> _
Structure CONSOLE_SCREEN_BUFFER_INFO
Dim dwSize As COORD
Dim dwCursorPosition As COORD
Dim wAttributes As Integer
Dim srWindow As SMALL_RECT
Dim dwMaximumWindowSize As COORD
End Structure ' Win32 API Function declarations.
Declare Auto Function GetStdHandle Lib "kernel32.dll" (ByVal nStdHandle As Integer) As IntPtr
Declare Auto Function FillConsoleOutputCharacter Lib "kernel32.dll" (ByVal hConsoleOutput As IntPtr, ByVal cCharacter As Byte, _
ByVal nLength As Integer, _
ByVal dwWriteCoord As COORD, _
ByRef lpNumberOfCharsWritten As IntPtr) As Integer
Declare Auto Function GetConsoleScreenBufferInfo Lib "kernel32.dll" (ByVal hConsoleOutput As IntPtr, _
ByRef lpConsoleScreenBufferInfo As CONSOLE_SCREEN_BUFFER_INFO) As Integer
Declare Auto Function SetConsoleCursorPosition Lib "kernel32.dll" (ByVal hConsoleOutput As IntPtr, ByVal dwCursorPosition As COORD) As Integer ' Subroutine used to clear the Console screen.
Public Sub Clear()
Dim hConsoleHandle As IntPtr
Dim hWrittenChars As IntPtr
Dim strConsoleInfo As CONSOLE_SCREEN_BUFFER_INFO
Dim strOriginalLocation As COORD
hConsoleHandle = GetStdHandle(STD_OUTPUT_HANDLE) ' Get Handle for standard output
GetConsoleScreenBufferInfo(hConsoleHandle, strConsoleInfo) ' Get information about the standard output buffer of the Console
FillConsoleOutputCharacter(hConsoleHandle, EMPTY, strConsoleInfo.dwSize.X * strConsoleInfo.dwSize.Y, strOriginalLocation, hWrittenChars) ' Fill output buffer with Empty characters (ASCII 32)
SetConsoleCursorPosition(hConsoleHandle, strOriginalLocation) ' Set the Console cursor back to the origin
End SubEnd Class