elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  problema con DCOM en VB
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: problema con DCOM en VB  (Leído 1,468 veces)
^kazike^

Desconectado Desconectado

Mensajes: 88



Ver Perfil
problema con DCOM en VB
« en: 19 Febrero 2008, 15:07 pm »

Hola, tengo el siguiente codigo:
Código:
ublic Function CreateScriptTemplate(TestKey As Long, _
        ByRef LocalPath As String) As Long
    ' Create a batch file to emulate a test script for

    ' this example

    Dim myf As String
   
    Dim path As String

    LocalPath = "c:\temp"

    myf = "C:\temp\batch.bat"
   
    'user must input the nunit path to can execute it
    path = InputBox("Enter the path where Nunit is intalled:", "Path needed")
    While (path = "")
     path = InputBox("Enter the path where Nunit is intalled:", "Path needed")
    Wend

    Open myf For Output As #1

    Print #1, "cd C:\Archivos de Programa\NUnit 2.4.5\bin" & vbCrLf & "nunit.exe" & vbCrLf & "pause"
   
    Close #1

    CreateScriptTemplate = 1

End Function
El caso es que al llegar al bucle se cuelga, no se por qué.
El proyecto es un exe activeX y es lanzado por otra aplicacion, no se si eso influirá, porque no creo ningun form ni na de eso
Gracias y Saludos


En línea

pana88

Desconectado Desconectado

Mensajes: 76


Fhacking


Ver Perfil WWW
Re: problema con DCOM en VB
« Respuesta #1 en: 24 Febrero 2008, 18:31 pm »

la respuesta es obvia si pone bien o mal el path vb va a volver a repetir el bucle ...
pone algun of para que salga del bucle por que o sino siempre va avolver a hacer lo mismo es por eso que se cuelga


En línea

Chefito

Desconectado Desconectado

Mensajes: 122



Ver Perfil WWW
Re: problema con DCOM en VB
« Respuesta #2 en: 24 Febrero 2008, 22:02 pm »

Que va. Ese codigo está bien.Debería funcionar bien (por lo menos en un proyecto EXE. En un activeX no tengo ni idea.....aunque no veo porque va a ir mal eso :-\). Hazlo paso a paso en el depurador a ver si ves que ocurre. pana88 el bucle si acaba. Se repite mientras la variable path esté vacía (vamos, que no pones nada en el inputbox) yo lo haría así, ya que por narices tiene que hacerlo una vez por lo menos:
Código:
   Do
     path = InputBox("Enter the path where Nunit is intalled:", "Path needed")
    loop until path<>""
Saludos.
En línea

Moderador del foro oficial de AutoIt en español: www.AutoIt.es.

Todos tenemos inteligencia, lo malo es que algunos no nos acordamos donde la dejamos guardada ;)
^kazike^

Desconectado Desconectado

Mensajes: 88



Ver Perfil
Re: problema con DCOM en VB
« Respuesta #3 en: 25 Febrero 2008, 13:22 pm »

Hola, no he podido encontrar el fallo asi que he decido replantearme el camino a seguir. He creado otro activeX que es llamado por el primero para coger los datos.
El problem aes que al compilar me aparece el siguiente error:
No se encuentra el miembro o metodo de datos:
Este es el codigo:
Código:
'These members represent the main TestType object properties.

Public RemoteAgentCLSID As String ' Run Remote Agent Class ID

Public ScriptViewerCLSID As String ' ActiveX script viewer Class ID

Public TestingToolName As String ' Remote Agent name

Public ExecConfigCLSID As String ' Configuration Class ID

Public CanCreateScriptTemplate As Long ' Flag

Public LastErrorMessage As String ' Most common error message

Public ResultViewerCLSID As String ' ActiveX result viewer Class ID

Private td As TDConnection
'variable of type clsActivexEx class in Activex_ex component

'create an object for class clsActivexEx in AxtivexEx component
Dim actvixTest As Class1




Private Sub Class_Initialize()

'This sub-routine is run when the TestType is loaded.

'Note that at this time, none of the optional controls is

' supported, as their class ID strings are empty.

'Also note that the remote agent class ID is empty,

' as no such agent yet exists.

'This example does not support script templates,

' and has only one error type.

 

    ExecConfigCLSID = "" ' No configuration utility provided

    RemoteAgentCLSID = "{78888EDF-6BCB-4477-AB18-9DA7D483CC52}"

    ScriptViewerCLSID = "{472B9CAC-C738-43BE-A0A7-EB6AB1B8BDEA}"

    TestingToolName = "Script"

    CanCreateScriptTemplate = 1 ' create new test feature turned on

    LastErrorMessage = "" ' Testing issues

    ResultViewerCLSID = "" ' No result viewer ActiveX provided

    LoadPicture ""
   
   

End Sub



Public Sub Init(mytd As Variant)

    ' You may need a TDConnection to use OTA functions in your application.

    ' If you do, add a project reference to the OTA:

    ' In Projects > References, check the "OTA COM 8.0 Type Library."

    ' and declare a module-level variable: Private td As TDConnection

    Set td = mytd 'Get the td object to be used if needed

End Sub



Public Function CreateScriptTemplate(TestKey As Long, _
        ByRef LocalPath As String) As Long
       
    Set actvixTest = New Class1
   
    ' Create a batch file to emulate a test script for

    ' this example

    Dim myf As String
   
    Dim path As String

    'Load the form to interact with the user and get the data
    [b]actvixTest.LoadForm[/b]
    path = actvixTest.getselectedchar
    actvixTest.Form_Unload
   
    LocalPath = "c:\temp"

    myf = "C:\temp\batch.bat"

    Open myf For Output As #1

    Print #1, "cd C:\Archivos de Programa\NUnit 2.4.5\bin" & vbCrLf & "nunit.exe" & vbCrLf & "pause"
    Print #1, vbCrLf & path
   
    Close #1

    CreateScriptTemplate = 1

End Function



Public Function GetBitmap(Status As Long) As Long

      GetBitmap = 0 'no bitmap

   End Function


Private Sub Form_Unload(Cancel As Integer)

   'on closing the form set the object actvixTest to point to nothing

   'thereby removing reference the class clsActivexEx in component Activex_ex

   Set actvixTest = Nothing

End Sub

El error me lo da en "actvixTest.LoadForm"
El codigo del .cls del activeX es:
Código:
Option Explicit

Public Function LoadForm()

   'Load the form

   Load formActiveX

   formActiveX.Caption = formActiveX.Caption

   formActiveX.Show

End Function

Private Sub Class_Initialize()

   'selectedItem is a global variable declared in module

   'set it to nothing initially

   'whcih implies that no item has been selected

   selectedItem = "nothing"

End Sub

Private Sub Class_Terminate()

   'on terminating unload the form

   Unload formActiveX

End Sub

Public Function getselectedchar() As String

   'function that gets the item selected in the drop-down box

   getselectedchar = selectedItem
   

End Function

Public Sub Form_Unload()

Unload formActiveX

End Sub
Tb he añadido una referencia a este ultimo archivo.
Gracias y Saludos
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
ayuda dcom c++
Programación C/C++
tommylej 0 1,197 Último mensaje 17 Septiembre 2013, 11:20 am
por tommylej
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines