Private Sub Form_Load()
MsgBox Command$
End Sub
Private Sub Form_Load()
MsgBox Command$
End Sub
Где-то я слышал про VB для доса, но что-то я с трудом могу себе представить подобное...А вот автору стоит задуматься над тем где ж он узрел DOS?
ANDLL писал(а):Есть такое. Visual Basic 1. for MS-DOS.Где-то я слышал про VB для доса
ANDLL писал(а):При чем здесь объекты и визуальность?
А что там было визуального? Объекты в VB-1 существовали?
что же правильного во втором ответе?И несмотря на краткость он дает правильный ответ на оба вопроса.
И что же он хочет... ?
получить параметры
Private Const FOREGROUND_GREEN = &H2
Private Const FOREGROUND_RED = &H4
Private Const BACKGROUND_BLUE = &H10
Private Const BACKGROUND_GREEN = &H20
Private Const BACKGROUND_RED = &H40
Private Const BACKGROUND_INTENSITY = &H80&
Private Const BACKGROUND_SEARCH = &H20&
Private Const FOREGROUND_INTENSITY = &H8&
Private Const FOREGROUND_SEARCH = (&H10&)
Private Const ENABLE_LINE_INPUT = &H2&
Private Const ENABLE_ECHO_INPUT = &H4&
Private Const ENABLE_MOUSE_INPUT = &H10&
Private Const ENABLE_PROCESSED_INPUT = &H1&
Private Const ENABLE_WINDOW_INPUT = &H8&
Private Const ENABLE_PROCESSED_OUTPUT = &H1&
Private Const ENABLE_WRAP_AT_EOL_OUTPUT = &H2&
Private Const STD_OUTPUT_HANDLE = -11&
Private Const STD_INPUT_HANDLE = -10&
Private Const STD_ERROR_HANDLE = -12&
Private Const INVALID_HANDLE_VALUE = -1&
Private Declare Function AllocConsole Lib "kernel32" () As Long
Private Declare Function FreeConsole Lib "kernel32" () As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function GetStdHandle Lib "kernel32" (ByVal nStdHandle As Long) As Long
Private Declare Function WriteConsole Lib "kernel32" Alias "WriteConsoleA" (ByVal hConsoleOutput As Long, lpBuffer As Any, ByVal nNumberOfCharsToWrite As Long, lpNumberOfCharsWritten As Long, lpReserved As Any) As Long
Private Declare Function ReadConsole Lib "kernel32" Alias "ReadConsoleA" (ByVal hConsoleInput As Long, ByVal lpBuffer As String, ByVal nNumberOfCharsToRead As Long, lpNumberOfCharsRead As Long, lpReserved As Any) As Long
Private Declare Function SetConsoleTextAttribute Lib "kernel32" (ByVal hConsoleOutput As Long, ByVal wAttributes As Long) As Long
Private Declare Function SetConsoleTitle Lib "kernel32" Alias "SetConsoleTitleA" (ByVal lpConsoleTitle As String) As Long
Private hConsoleOut As Long, hConsoleIn As Long, hConsoleErr As Long
Private Sub Form_Load()
If AllocConsole() Then
hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE)
If hConsoleOut = INVALID_HANDLE_VALUE Then MsgBox "Unable to get STDOUT"
hConsoleIn = GetStdHandle(STD_INPUT_HANDLE)
If hConsoleOut = INVALID_HANDLE_VALUE Then MsgBox "Unable to get STDIN"
Else
MsgBox "Couldn't allocate console"
End If
SetConsoleTitle "The KPD-Team 2001"
SetConsoleTextAttribute hConsoleOut, FOREGROUND_RED Or FOREGROUND_GREEN Or FOREGROUND_INTENSITY Or BACKGROUND_BLUE
ConsoleWriteLine "Hello World!" ' работает, но в другой консоли
End Sub
Private Sub Form_Unload(Cancel As Integer)
CloseHandle hConsoleOut
CloseHandle hConsoleIn
FreeConsole
End Sub
Sub ConsoleWriteLine(sInput As String)
ConsoleWrite sInput + vbCrLf
End Sub
Sub ConsoleWrite(sInput As String)
Dim cWritten As Long
WriteConsole hConsoleOut, ByVal sInput, Len(sInput), cWritten, ByVal 0&
End Sub
Function ConsoleReadLine() As String
Dim ZeroPos As Long
ConsoleReadLine = String(10, 0)
ReadConsole hConsoleIn, ConsoleReadLine, Len(ConsoleReadLine), vbNull, vbNull
ZeroPos = InStr(ConsoleReadLine, Chr$(0))
If ZeroPos > 0 Then ConsoleReadLine = Left$(ConsoleReadLine, ZeroPos - 3)
End Function
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 143