Prikazi cijelu temu 13.05.2015 10:50
Gjoreski Van mreze
Administrator
Registrovan od:02.02.2009
Lokacija:Ohrid Makedonija


Predmet:Re: Gzip arhiver
Probaj da koristis ShellAndWait funcija za da znaes koga e zavrsen procesot isto mozes i progres bar da stavis za da e popregledno.
Eve ova stavi vo nekoj modul
PreuzmiIzvorni kôd (Visual Basic):
  1. Option Explicit
  2.  
  3. Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
  4. Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
  5. Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
  6.  
  7. Private Const SYNCHRONIZE = &H100000
  8. Private Const INFINITE = -1&
  9.  
  10. ' Start the indicated program and wait for it
  11. ' to finish, hiding while we wait.
  12. Public Sub ShellAndWait(ByVal program_name As String, ByVal window_style As VbAppWinStyle)
  13. Dim process_id As Long
  14. Dim process_handle As Long
  15.  
  16.     ' Start the program.
  17.    On Error GoTo ShellError
  18.     process_id = Shell(program_name, window_style)
  19.     On Error GoTo 0
  20.  
  21.     DoEvents
  22.  
  23.     ' Wait for the program to finish.
  24.    ' Get the process handle.
  25.    process_handle = OpenProcess(SYNCHRONIZE, 0, process_id)
  26.     If process_handle <> 0 Then
  27.         WaitForSingleObject process_handle, INFINITE
  28.         CloseHandle process_handle
  29.     End If
  30.  
  31.     Exit Sub
  32.  
  33. ShellError:
  34. Call MsgBox("PROBLEM SO PROCESOT  " & Err & "  " & Error, vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "")
  35. End Sub