01. marts 2002 - 14:20Der er
14 kommentarer og 2 løsninger
Timer - kør igen først når script er færdigt.
Jeg fik denne kode af en i går. Den køre perfekt men kan man få VB til at tjekke om filen i forvejen køre inden man exeuter den igen. Det er fordi det kan godt ske at den ikke er færdig med scriptet som det ser ud nu. ------- Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const INFINITE = &HFFFF Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
I timer-eventet
dim hHand as long hHand = ShellExecute Me.hwnd, vbNullString, "c:\run\sys.vbs", vbNullString, vbNullString, vbHide if hHand>32 then WaitForSingleObject hHand, INFINITE
Const INFINITE = &HFFFF Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Timer1_Timer()
dim hHand as long hHand = ShellExecute Me.hwnd, vbNullString, "c:\run\sys.vbs", vbNullString, vbNullString, vbHide if hHand>32 then WaitForSingleObject hHand, INFINITE MyCount = MyCount + 1 If MyCount > 100000 Then MyCount = 1
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function GetProcessVersion Lib "Kernel32.dll" (ByVal lProcessID As Long) As Long
Private Sub WaitForProcessToEnd(PID As Long) Do DoEvents Loop While GetProcessVersion(PID) <> 0 End Sub
jeg fant en anden løsning .. men tak for jeres tid ..
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.