Attribute VB_Name = "IntDocView"
Option Explicit
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String) As Long
Public DesbloquearCierre As Byte

Public Sub IniciarDocVisor(Comandos As String, PForm As Form)
Dim EnEjecucion As Boolean, i As Byte, PFormEjecutandose As Boolean
Dim BufCmd As String
For i = 0 To Forms.Count - 1
If Forms(i) Is Form6 Then
DesbloquearCierre = 1
Unload Form6
Exit For
End If
Next
DesbloquearCierre = 0
Load Form6
Form6.Show
Call CaptureConsole.ExecAndCapture(Comandos, , , 1, , , , BufCmd)
For i = 0 To Forms.Count - 1
If Forms(i) Is Form6 Then
EnEjecucion = True
Exit For
End If
Next
If EnEjecucion = False Then Exit Sub
Call SetWindowText(Form6.Text1.hWnd, BufCmd)
Form6.Frame3.Visible = False
PFormEjecutandose = True
While EnEjecucion
DoEvents
EnEjecucion = False
PFormEjecutandose = False
For i = 0 To Forms.Count - 1
If Forms(i) Is Form6 Then EnEjecucion = True
If Forms(i) Is PForm Then PFormEjecutandose = True
Next
If PFormEjecutandose = False Then
Unload Form6
EnEjecucion = False
End If
If EnEjecucion Then
FormPosX = Form6.Left
FormPosY = Form6.Top
End If
Wend
End Sub

Public Sub CerrarDocVisor()
Dim i As Integer
For i = 0 To Forms.Count - 1
If Forms(i) Is Form6 Then
Unload Form6
Exit For
End If
Next
End Sub
