Posted on 2000-03-29
You recommended a solution for someone attempting to use the Winzip self extractor utility. I'm attempting the same thing. I'm using the following code that someone posted on experts exchange. I have the Zip and Unzip working fine but I can't get the create self extractor to work. Any suggestions:
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
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
Const WinZipEXCPath = "C:\Program Files\Winzip\Wzsepe32.exe"
Const WinZipEXEPath = "C:\Program Files\WinZip\Winzip32.exe"
Const SYNCHRONIZE = &H100000
Const INFINITE = &HFFFF ' Wait forever
Const WAIT_OBJECT_0 = 0 ' The state of the specified object is signaled
Const WAIT_TIMEOUT = &H102 ' The time-out interval elapsed and the object’s state is nonsignaled.
Public Function ShellExecAndWait(ProgramPathAndName As String, Optional cmd As String = "")
Dim lPid As Long
Dim lHnd As Long
Dim lRet As Long
If Trim(ProgramPathAndName) = "" Then Exit Function
lPid = Shell(Trim(ProgramPathAndName) + " " + Trim(cmd), vbNormalFocus)
If lPid <> 0 Then
'Get a handle to the shelled process.
lHnd = OpenProcess(SYNCHRONIZE, 0, lPid)
'If successful, wait for the application to end and close the handle.
If lHnd <> 0 Then
lRet = WaitForSingleObject(lHnd, INFINITE)
'MsgBox "Just terminated.", vbInformation, "Shelled Application"
ShellExecAndWait WinZipEXCPath, "c:\Test\Four.zip"
I need it to run silently.