Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setup toolkit to distribute MSDE-based project

Status
Not open for further replies.

pdx1ajm

Programmer
Apr 24, 2001
7
US
I am using the VB6 Setup Toolkit to write an install procedure to install MSDE and attach a database. I've got the MSDE launching, but then it hangs and after I've waited long enough to be convinced it's really stuck (I know MSDEx86 takes a good long while to install), the Task Manager shows that the Setup.exe process is taking 99% of the CPU and the msdex86.exe process has only had 5 seconds of run time.

Here's the code I figure it's sticking on.
sqlcmd = Chr(34) & gstrDestDir & "setup\msdex86.exe" & Chr(34) & "-a -SMS -s -f1 " & Chr(34) & gstrDestDir & "setup\setup.iss" & Chr(34)

ExecCmd sqlCmd


Public Sub ExecCMD(cmdLine)
' 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. Note that the setup does some
' posting of messages to the desktop. If we simply waited for the setup to finish
' via WaitForSingleObject, the VB application would not be processing these messages
' and the setup would hang. So we use MsgWaitForMultipleObjects and the DoEvents()
' function to allow the VB app to process these messages and allow setup to finish.

i = 0


Do
ret = MsgWaitForMultipleObjects(1&, Proc.hProcess, 0&, INFINITE, _
(QS_POSTMESSAGE Or QS_SENDMESSAGE))
If ret = (WAIT_OBJECT_0) Then Exit Do 'The process ended.
OpenForms = DoEvents()

' Cut off the process if it does not respond.
' The higher the number, the more tolerant the installation.
If i = 99999 Then
CloseHandle (Proc.hProcess)
Call MsgBox("There is no response from the command line statement. Process Terminated", vbCritical)
Err.Raise (0)
End If
i = i + 1

Loop

Thank you.
 
I figured it out. There's a flaw in the example provided by Microsoft which is addressed in an MSDN problem Article. The msgwaitformultipleobjects() line needs to be adjusted to look like this (note the final parameter):
ret = MsgWaitForMultipleObjects(1&, Proc.hProcess, 0&, INFINITE, QS_AllInput)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top