Ver Mensaje Individual
  #43 (permalink)  
Antiguo 25/08/2008, 08:57
Avatar de moradazo
moradazo
 
Fecha de Ingreso: julio-2008
Ubicación: [email protected]
Mensajes: 355
Antigüedad: 16 años, 8 meses
Puntos: 2
Respuesta: Visual Basic 2005. Salvar archivos desde Visual Basic.

Gracias David, ahora el resultado es al contrario, para cualquier boton que ejecuto me dice que la ventana no esta abierta, y ret para cualquier boton siempre me esta dando cero.

Este es el codigo:

Código PHP:
Public Class Form1 

    
Const MSOutlook "OpusApp"
    
Const MSExcel "XLMAIN"
    
Const MSIExplorer "IEFrame"
    
Const MSVBasic "wndclass_desked_gsk"
    
Const NotePad "Notepad.txt"
    
Const MyVBApp "ThunderForm"


    
<System.Runtime.InteropServices.DllImport("user32.dll")> _
Private Shared Function FindWindow_
    ByVal lpClassName 
As String_
    ByVal lpWindowName 
As String) As System.IntPtr
    End 
Function


    Private 
Sub Comprobar(ByVal clase As String)

        
Dim ret As Long
        ret 
FindWindow("Clase"Nothing)
        If 
ret <> 0 Then
            MsgBox
("La aplicación está abierta"vbInformation vbOKOnly)
        Else
            
MsgBox("La aplicación NO está abierta"vbInformation vbOKOnly)
        
End If

    
End Sub

    
Private Sub Form_Load()
        
Button1.Capture " Internet Explorer "
        
Button2.Capture " Microsoft Outlook "
        
Button3.Capture " Microsoft Excel "
        
Button4.Capture " Bloc de notas "
        
Button5.Capture " Visual basic "
    
End Sub

    
Private Sub Button4_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button4.Click
        Comprobar
(NotePad)
    
End Sub

    
Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button1.Click
        Comprobar
(MSIExplorer)
    
End Sub

    
Private Sub Button3_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button3.Click
        Comprobar
(MSExcel)
    
End Sub

    
Private Sub Button2_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button2.Click
        Comprobar
(MSOutlook)
    
End Sub

    
Private Sub Button5_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button5.Click
        Comprobar
(MSVBasic)
    
End Sub
End 
Class 
Aqui el cambio que hice fue .caption por .capture, donde se esta cargando el form, ya que si dejo caption, el programa me da un error de que Caption no es miembro de Systems.Windows.Forms.Button