Predmet:Re: shell i kill funkcija u VB6
compile error:
Variable not defined
zaplavi mi se ovdje : process_handle = OpenProcess(SYNCHRONIZE, 0, process_id)
ovo:SYNCHRONIZE
evo nasao na internetu i radi
PreuzmiIzvorni kôd (Visual Basic):Option Explicit
DefInt A-Z
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 Byte
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 Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds 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 Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Dim Path As String
Private Sub ExecCmd(CmdLine As String)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ret&
'
' Initialize the STARTUPINFO structure:
'
start.cb = Len(start)
'
' Start the shelled application:
'
ret& = CreateProcessA(0&, CmdLine, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
'
' Wait for the shelled application to finish:
'
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
ret& = CloseHandle(proc.hProcess)
MsgBox "process has finished"
End Sub
Private Sub cmdStart_Click()
Me.Hide
Dim program_name As String
program_name = App.Path & "\7za e data.zip -y"
ExecCmd program_name
Kill App.Path & "\Data.zip"
Me.Show
End Sub
Private Sub Form_Load()
Path = App.Path
If Right$(Path, 1) <> "\" Then Path = Path & "\"
Me.Show
End Sub
jos me zanima dali ovo u proceduri Form_Load
If Right$(Path, 1) <> "\" Then Path = Path & "\"
stavlja znak \ pa necu morati dodavati nigdje u programu App.Path & "/"
i jos me zanima kako iskljuciti dos prozor da se nevidi
Prilozi:
VB6_shell_Kill.rar
Preuzimanja:347
Velicina datoteke:352.84 KB
zivot je moja domovina.
Ovaj post je ureden
1
puta. Posljednja izmjena 08.09.2015 10:18 od strane Avko.