Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Installation continues after launching Oracle net


1 reply to this topic

vrrajesh

vrrajesh
  • Members
  • 7 posts

Posted 24 April 2002 - 06:36

HI,

I am creating a setup using Installshield Developer 7.0. I am alunching installation package for Oraclew net client from my installation using LaunchAppandWait. But my installation program is not waiting for the other installation to complete. I think this is due to the termination of the oracle setup program which in turn launches another setup program which installs the net client.

If anybody has encountered this problem and solved it, please let me know.

Thanks,
Rajesh

gunavelu

gunavelu
  • Members
  • 23 posts

Posted 03 May 2002 - 09:52

Use this code. Get the process name from task manager and substitute accordingly

Public Declare Function Process32First Lib "kernel32" ( _
        ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long

Public Declare Function Process32Next Lib "kernel32" ( _
        ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long

Public Declare Function CloseHandle Lib "Kernel32.dll" _
        (ByVal Handle As Long) As Long

Public Declare Function OpenProcess Lib "Kernel32.dll" _
       (ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, _
           ByVal dwProcId As Long) As Long

Public Declare Function EnumProcesses Lib "psapi.dll" _
        (ByRef lpidProcess As Long, ByVal cb As Long, _
           ByRef cbNeeded As Long) As Long

Public Declare Function GetModuleFileNameExA Lib "psapi.dll" _
        (ByVal hProcess As Long, ByVal hModule As Long, _
           ByVal ModuleName As String, ByVal nSize As Long) As Long

Public Declare Function EnumProcessModules Lib "psapi.dll" _
        (ByVal hProcess As Long, ByRef lphModule As Long, _
           ByVal cb As Long, ByRef cbNeeded As Long) As Long

Public Declare Function CreateToolhelp32Snapshot Lib "kernel32" ( _
        ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long

Public Declare Function GetVersionExA Lib "kernel32" _
        (lpVersionInformation As OSVERSIONINFO) As Integer
       
Public Declare Function WaitForInputIdle Lib "user32" (ByVal hProcess As Long, ByVal dwMilliseconds As Long) As Long

Public Type PROCESSENTRY32
  dwSize As Long
  cntUsage As Long
  th32ProcessID As Long           ' This process
  th32DefaultHeapID As Long
  th32ModuleID As Long            ' Associated exe
  cntThreads As Long
  th32ParentProcessID As Long     ' This process's parent process
  pcPriClassBase As Long          ' Base priority of process threads
  dwFlags As Long
  szExeFile As String * 260       ' MAX_PATH
End Type

Public Type OSVERSIONINFO
  dwOSVersionInfoSize As Long
  dwMajorVersion As Long
  dwMinorVersion As Long
  dwBuildNumber As Long
  dwPlatformId As Long           '1 = Windows 95.
                                 '2 = Windows NT

  szCSDVersion As String * 128
End Type

Public Const PROCESS_QUERY_INFORMATION = 1024
Public Const PROCESS_VM_READ = 16
Public Const MAX_PATH = 260
Public Const STANDARD_RIGHTS_REQUIRED = &HF0000
Public Const SYNCHRONIZE = &H100000
'STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &HFFF
Public Const PROCESS_ALL_ACCESS = &H1F0FFF
Public Const TH32CS_SNAPPROCESS = &H2&
Public Const hNull = 0
Public Const INFINITE = &HFFFFFFFF

Function StrZToStr(s As String) As String
  StrZToStr = Left$(s, Len(s) - 1)
End Function

Public Function getVersion() As Long
  Dim osinfo As OSVERSIONINFO
  Dim retvalue As Integer
  osinfo.dwOSVersionInfoSize = 148
  osinfo.szCSDVersion = Space$(128)
  retvalue = GetVersionExA(osinfo)
  getVersion = osinfo.dwPlatformId
End Function

Sub Main()

  Dim cb As Long
  Dim cbNeeded As Long
  Dim NumElements As Long
  Dim ProcessIDs() As Long
  Dim cbNeeded2 As Long
  Dim NumElements2 As Long
  Dim Modules(1 To 200) As Long
  Dim lRet As Long
  Dim ModuleName As String
  Dim nSize As Long
  Dim hProcess As Long
  Dim i As Long
  Dim pos
  Dim oldpos
  Dim bool
  'Get the array containing the process id's for each process object
  cb = 8
  cbNeeded = 96
  Do While cb <= cbNeeded
     cb = cb * 2
     ReDim ProcessIDs(cb / 4) As Long
     lRet = EnumProcesses(ProcessIDs(1), cb, cbNeeded)
  Loop
  NumElements = cbNeeded / 4

  For i = 1 To NumElements
     'Get a handle to the Process
     hProcess = OpenProcess(PROCESS_QUERY_INFORMATION _
        Or PROCESS_VM_READ, 0, ProcessIDs(i))
     'Got a Process handle
     If hProcess <> 0 Then
         'Get an array of the module handles for the specified
         'process
         lRet = EnumProcessModules(hProcess, Modules(1), 200, _
                                      cbNeeded2)
         'If the Module Array is retrieved, Get the ModuleFileName
         If lRet <> 0 Then
         
            ModuleName = Space(MAX_PATH)
            pos = 1
            oldpos = 0
           
            nSize = 500
            lRet = GetModuleFileNameExA(hProcess, Modules(1), _
                            ModuleName, nSize)
            bool = InStr(1, ModuleName, "yoursetup.exe", vbTextCompare)
             
            If bool <> 0 Then
              While hProcess <> 0
                 CloseHandle (hProcess)
                 hProcess = OpenProcess(PROCESS_QUERY_INFORMATION _
                               Or PROCESS_VM_READ, 0, ProcessIDs(i))
              Wend
             Else
                 'Failure
            End If
         End If
     End If
   'Close the handle to the process
  lRet = CloseHandle(hProcess)
  Next
End Sub

Include this as a cutom action at the point where you want to wait.
Gunavelu