Option Explicit
Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Const PROCESS_QUERY_INFORMATION = &H400
Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Function IsProcessRunning(pid As Long) As Boolean
Dim hProcess As Long
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, 0, pid)
CloseHandle hProcess
IsProcessRunning = hProcess
End Function
Private Sub Command1_Click()
Dim i As Integer
Dim ProcessID As Long
Dim x As Object
On Error Resume Next
ProcessID = Shell(Environ$("COMSPEC") & " /C " & "vb6 /make ""c:\bobrodes\activex dll\mycomponent.vbp""")
Do While IsProcessRunning(ProcessID)
i = i + 1
If i = 100 Then
Err.Raise vbObjectError + 1000, "Shell Process", "Timeout"
End If
Sleep 100
Loop
Set x = CreateObject("mycomponent.myclass")
x.mymethod
'With CreateObject("mycomponent.myclass")
' .mymethod
'End With
End Sub