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

 

 


Tema destacado: Tutorial básico de Quickjs


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  Funciona desde el VS2010 pero la App compilada no !
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Funciona desde el VS2010 pero la App compilada no !  (Leído 1,961 veces)
TrashAmbishion


Desconectado Desconectado

Mensajes: 756


Ver Perfil
Funciona desde el VS2010 pero la App compilada no !
« en: 15 Marzo 2013, 20:45 pm »

Amigos tengo una urgencia, la App que estoy trabajando corre sin problema alguno desde el VS2010 lo que hace es comunicarse por el SerialPort con un Celular mandando comandos AT y recibiendo respuestas.

Ahora cuando ejecuto el .EXE no me da la respuesta del Cell nada mas me muestra el comando que envio con la respuesta inicial OK pero no me llegan los otros datos y les digo que desde el VS2010 si llegan que puede estar pasando les pongo el codigo.

Código
  1.  
  2. Imports System.Text
  3.  
  4. Public Class MainForm
  5.  
  6.    ' Declare necessary class variables.
  7.    Private CommPort As New RS232()
  8.    Private IsModemFound As Boolean = False
  9.    Private ModemPort As Integer = 0
  10.  
  11.    ' This subroutine clears the TextBox.
  12.    Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click
  13.        Me.StatusTextbox.Clear()
  14.    End Sub
  15.  
  16.    ' This subroutine sends a user specified command to the modem, and records its
  17.    '   response. It depends on the timer to do the reading of the response.
  18.    Private Sub SendUserCommandButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendUserCommandButton.Click
  19.  
  20.        ' Always wrap up working with Comm Ports in exception handlers.
  21.        Try
  22.            ' Enable the timer.
  23.            'If Not Me.tmrReadCommPort.Enabled Then
  24.            Me.tmrReadCommPort.Enabled = True
  25.            'End If
  26.            'If Not CommPort.IsOpen Then
  27.            ' Attempt to open the port.
  28.            CommPort.Open(8, 115200, 8, RS232.DataParity.Parity_None, RS232.DataStopBit.StopBit_1, 4096)
  29.            'End If
  30.            'Write an user specified Command to the Port.
  31.            CommPort.Write(Encoding.ASCII.GetBytes(Me.UserCommandTextbox.Text & Chr(13)))
  32.            ' Sleep long enough for the modem to respond and the timer to fire.
  33.            System.Threading.Thread.Sleep(200)
  34.            Application.DoEvents()
  35.            CommPort.Close()
  36.  
  37.        Catch ex As Exception
  38.            ' Warn the user.
  39.            MessageBox.Show("Unable to communicate with Modem")
  40.        Finally
  41.            ' Disable the timer.
  42.            Me.tmrReadCommPort.Enabled = False
  43.        End Try
  44.  
  45.    End Sub
  46.  
  47.    ' This subroutine is fired when the timer event is raised. It writes whatever
  48.    '   is in the Comm Port buffer to the output window.
  49.    Private Sub tmrReadCommPort_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrReadCommPort.Tick
  50.        Try
  51.            ' As long as there is information, read one byte at a time and
  52.            '   output it.
  53.            While (CommPort.Read(1) <> -1)
  54.                ' Write the output to the screen.
  55.                WriteMessage(Chr(CommPort.InputStream(0)), False)
  56.            End While
  57.        Catch exc As Exception
  58.            ' An exception is raised when there is no information to read.
  59.            '   Don't do anything here, just let the exception go.
  60.        End Try
  61.  
  62.    End Sub
  63.  
  64.    ' This subroutine writes a message to the txtStatus TextBox.
  65.    Private Sub WriteMessage(ByVal message As String)
  66.        Me.StatusTextbox.Text += message + vbCrLf
  67.    End Sub
  68.  
  69.    ' This subroutine writes a message to the txtStatus TextBox and allows
  70.    '   the line feed to be suppressed.
  71.    Private Sub WriteMessage(ByVal message As String, ByVal linefeed As Boolean)
  72.        Me.StatusTextbox.Text += message
  73.        If linefeed Then
  74.            Me.StatusTextbox.Text += vbCrLf
  75.        End If
  76.    End Sub
  77.  
  78.    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
  79.        CommPort.Close()
  80.        End
  81.    End Sub
  82.  
  83.    Private Sub MainForm_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
  84.        CommPort.Close()
  85.    End Sub
  86.  
  87.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
X-oom funciona pero no funciona (sungoku?)
Multimedia
Lordofchaos 4 3,835 Último mensaje 12 Diciembre 2005, 20:44 pm
por Sourraund
Login con md5 , BD funciona pero no funciona « 1 2 »
PHP
securedigital 16 9,609 Último mensaje 25 Mayo 2007, 17:46 pm
por securedigital
emulador ps2 funciona pero....
Juegos y Consolas
cmcmc 1 1,649 Último mensaje 23 Junio 2007, 17:03 pm
por w0nt0n
Se me cierra mi apliacion de consola compilada con VS2010 ¿array?¿puntero?
Programación C/C++
Drakomorh 3 3,159 Último mensaje 23 Mayo 2011, 22:45 pm
por Drakomorh
Ubuntu 15.04 funciona desde el DVD pero no desde el rígido.
GNU/Linux
NOB2014 0 1,970 Último mensaje 25 Agosto 2015, 18:44 pm
por NOB2014
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines