Visual Basic, .NET, ASP, VBScript
 

   
   
     

Форум - Общий форум

Страница: 1 |

 

  Вопрос: Можно ли програмно закрыть окно DOS Добавлено: 23.06.02 08:45  

Автор вопроса:  alek
Можно ли програмно закрыть окно DOS

Ответить

  Ответы Всего ответов: 2  

Номер ответа: 1
Автор ответа:
 root



Вопросов: 12
Ответов: 147
 Web-сайт: www.vbnet.ru
 Профиль | | #1
Добавлено: 23.06.02 09:25

Можно, например если ты програмно сделал консольное окно, смотри пример:

'Example submitted by X-MaD (x-mad@zolnetwork.com)
'Visit his homepage at http://www.zolnetwork.com/x-mad/

'To use this example:
'Add a BAS Module and Remove the Form
'Put the code into the BAS Module
'Make sure the Project's Startup Object is set to 'Sub Main'
'(you can change this by going to Project->Project Properties->
'General Tab->Startup Object)
Option Explicit
Private Declare Function AllocConsole Lib "kernel32" () As Long
Private Declare Function FreeConsole Lib "kernel32" () As Long
Private Declare Function GetStdHandle Lib "kernel32" (ByVal nStdHandle As Long) 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 Declare Function WriteConsole Lib "kernel32" Alias "WriteConsoleA" (ByVal hConsoleOutput As Long, ByVal lpBuffer As Any, ByVal nNumberOfCharsToWrite As Long, lpNumberOfCharsWritten As Long, lpReserved As Any) As Long
Private Const STD_INPUT_HANDLE = -10&
Private Const STD_OUTPUT_HANDLE = -11&
Private Const STD_ERROR_HANDLE = -12&
Private Const FOREGROUND_RED = &H4
Private Const FOREGROUND_GREEN = &H2
Private Const FOREGROUND_BLUE = &H1
Private Const FOREGROUND_INTENSITY = &H8
Private Const BACKGROUND_RED = &H40
Private Const BACKGROUND_GREEN = &H20
Private Const BACKGROUND_BLUE = &H10
Private Const BACKGROUND_INTENSITY = &H80
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 hCmdIn As Long
Private hCmdOut As Long
Private hCmdError As Long
Sub Main()
    Dim CmdIn As String * 256
    Dim CmdOUT As String
    'Open New Console Window
    AllocConsole
    'Set te Console Title
    SetConsoleTitle "My Cmd Console"
    'Get The Console Handler<

Ответить

Номер ответа: 2
Автор ответа:
 alek



Вопросов: 3
Ответов: 1
 Профиль | | #2 Добавлено: 24.06.02 06:42

Спасибо!

Я открыл бат файлам, но из программы. А так нельзя?

Ответить

Страница: 1 |

Поиск по форуму



© Copyright 2002-2011 VBNet.RU | Пишите нам