Prikazi cijelu temu 08.09.2015 13:06
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Lokacija:Tuzla


Predmet:Re: shell i kill funkcija u VB6
U pravu si ovo je api i ja zaboravio dodati api na vrh modula.
PreuzmiIzvorni kôd (Visual Basic):
  1. Option Compare Database
  2. Option Explicit
  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. ' Usporava shel
  11. ' to finish, hiding while we wait.
  12. Private Sub UsporiShell(ByVal program_name As String, ByVal window_style As Integer)
  13. Dim process_id As Long
  14. Dim process_handle As Long
  15.     ' Start the program.
  16.    On Error GoTo ShellError
  17.     process_id = Shell(program_name, window_style)
  18.     On Error GoTo 0
  19.  
  20.     ' Wait for the program to finish.
  21.    ' Get the process handle.
  22.    process_handle = OpenProcess(SYNCHRONIZE, 0, process_id)
  23.     If process_handle <> 0 Then
  24.         WaitForSingleObject process_handle, INFINITE
  25.         CloseHandle process_handle
  26.     End If
  27.  
  28.     Exit Sub
  29.  
  30. ShellError:
  31.     MsgBox "Error starting task " & _
  32.          program_name & vbCrLf & _
  33.         Err.Description, vbOKOnly Or vbExclamation, _
  34.         "Error"
  35. End Sub
program_name-App.Path & "\7za e imeFajla.zip -y"
window_style=0

Window stil moze biti:
vbHide     0     Window is hidden and focus is passed to the hidden window.
vbNormalFocus     1     Window has focus and is restored to its original size and position.
vbMinimizedFocus 2     Window is displayed as an icon with focus.
vbMaximizedFocus    3    Window is maximized with focus.
vbNormalNoFocus    4    Window is restored to its most recent size and position. The currently active window remains active.
vbMinimizedNoFocus    6    Window is displayed as an icon. The currently active window remains active.
Podrška samo putem foruma, jer samo tako i ostali imaju koristi od toga.