|
|
|
Как поставить задержку?
|
|||
|---|---|---|---|
|
#18+
Из программы необходимо запустить .BAT файл, причём дальнейшее выполнение процедуры будет продолжено только после отработки этого батника. Win2000 AC2000 ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 09.10.2003, 16:12 |
|
||
|
Как поставить задержку?
|
|||
|---|---|---|---|
|
#18+
Создайте модуль Option Compare Database Option Explicit Global taskID As Long Private Type STARTUPINFO cb As Long lpReserved As String lpDesktop As String lpTitle As String dwX As Long dwY As Long dwXSize As Long dwYSize As Long dwXCountChars As Long dwYCountChars As Long dwFillAttribute As Long dwFlags As Long wShowWindow As Integer cbReserved2 As Integer lpReserved2 As Long hStdInput As Long hStdOutput As Long hStdError As Long End Type Private Type PROCESS_INFORMATION hProcess As Long hThread As Long dwProcessId As Long dwThreadID As Long End Type Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Private Declare Function CreateProcessA Lib "kernel32" (ByVal lpApplicationName As Long, ByVal lpCommandLine As _ String, ByVal lpProcessAttributes As Long, ByVal _ lpThreadAttributes As Long, ByVal bInheritHandles As Long, _ ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, _ ByVal lpCurrentDirectory As Long, lpStartupInfo As _ STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long Private Const NORMAL_PRIORITY_CLASS = &H20& Private Const INFINITE = -1& Public Function ExecuteTask(Path As String, Optional Parameters As String = "") As Long Dim Proc As PROCESS_INFORMATION Dim startup As STARTUPINFO Dim ret As Long Dim cmdline As String cmdline = Path If Trim(Parameters) <> "" Then cmdline = cmdline & " """ & Parameters & """" End If startup.cb = Len(startup) ret = CreateProcessA(0&, cmdline, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, startup, Proc) ExecuteTask = Proc.hProcess End Function Public Function IsTaskRunning(taskID As Long) As Boolean Dim ret As Long If taskID = 0 Then Exit Function ret = WaitForSingleObject(taskID, 0) IsTaskRunning = (ret <> 0) If Not IsTaskRunning Then ret = CloseHandle(taskID) taskID = 0 End If End Function Создайте процедуру Private Sub Кнопка7_Click() Dim taskID As Long taskID = ExecuteTask("c:\Phoenix\cpy.bat") bb: If IsTaskRunning(taskID) Then GoTo bb End Sub Не супер, конечно, но работает. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 09.10.2003, 16:17 |
|
||
|
Как поставить задержку?
|
|||
|---|---|---|---|
|
#18+
Set WshShell = CreateObject("WScript.Shell") Return = WshShell.Run("my.bat", 0, true) ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 09.10.2003, 16:18 |
|
||
|
Как поставить задержку?
|
|||
|---|---|---|---|
|
#18+
Или посмотри еще здесь ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 09.10.2003, 16:26 |
|
||
|
|

start [/forum/topic.php?fid=45&tid=1678939]: |
0ms |
get settings: |
9ms |
get forum list: |
16ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
86ms |
get topic data: |
11ms |
get forum data: |
3ms |
get page messages: |
51ms |
get tp. blocked users: |
2ms |
| others: | 232ms |
| total: | 418ms |

| 0 / 0 |
