Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > ASM y Microcontroladores
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 06-04-2009
clavijo83 clavijo83 is offline
Registrado
 
Registrado: abr 2009
Posts: 8
Poder: 0
clavijo83 Va por buen camino
hola federico bueno la verdad ya me funciono ya retorna un valor la funcion llebanda, la funcion quedo asi:

Código Delphi [-]
function leebanda:PChar;stdcall;
var
  sTmp:String;
  PCharString: array[0..255] of Char;
  c1,rebut: integer;
  chBuffer: array[0..150] of char;
  NumberOfBytesRead: dword;
begin
//abro el puerto
  AbrirPuerto('COM1','1200','E','7','1');
//mensaje de solicitud de lectura
  banda;
repeat
  rebut:=0;
    repeat
      if ComFile=INVALID_HANDLE_VALUE then
        Exit;
        if not ReadFile(ComFile, chBuffer[rebut],1, NumberOfBytesRead, nil) then
          raise Exception.Create('Imposible leer datos desde el puerto');
          for c1:= 0 to NumberOfBytesRead - 1 do
          sTmp:= sTmp+chBuffer[c1];
    until rebut<100 ;
      if chBuffer[rebut]=chr(04) then
      begin
        CerrarPuerto;
        //libero memoria
        SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF);
        break;
      end;
until rebut=100;

sTmp:=Trim(sTmp);
sTmp:=copy(sTmp,7,(length(sTmp)-9));
Result := StrPCopy(PCharString, sTmp);
end;

pero ahora hay un problema en el codigo de visual:

Código:
Private Sub boton_leer_banda_Click()
    Dim txt As String
    Dim token As String
    Dim msj As String
    ' Se llama a la función del VPOS para leer la banda de tarjetas de créditos y débitos
    retorno = leebanda
    ' Se obtiene el valor del string que retorna la función del VPOS
    ' este string posee los valores de los tracks de la tarjeta a la cual se le leyo la banda
    'x = retorno
    retorno = GetToken(retorno, ";") '& vbCrLf
    Do
        token = GetToken("", ";")
        If token = "" Then Exit Do
        retorno = retorno  '& vbCrLf
        txt = token
    Loop
        ' Se asigna en la box de texto el valor de los diferentes tracks
        If retorno <> "" Then
            var = InStr(1, retorno, "?")
            msj = Mid(retorno, 2, var - 2) 'AQUI APARECE EL ERROR
            txt_track1.Text = msj
        Else
            txt_track1.Text = ""
        End If
        If txt <> "" Then
            var = InStr(1, txt, "?")
            msj = Mid(txt, 1, var - 2)
            txt_track2.Text = msj
        Else
            txt_track2.Text = ""
        End If
End Sub
me sale el siguiente error: ERROR '5' EN TIEMPO DE EJECUCION. LLAMADA A PROCEDIMIENTO O ARGUMENTO NO VALIDO.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Error al LLamar un DLL, "memoria Insuficiente" clavijo83 Varios 0 02-04-2009 18:34:50
Lectura Hexadecimal desde el puerto serie djemix Varios 20 09-12-2007 15:22:55
Particiones en "solo lectura " con cd_live de knoppix Diavlo Linux 1 03-10-2007 04:06:26
error de sql server "Informacion de columna clave insuficiente" jhcaboverde Conexión con bases de datos 1 17-08-2007 19:40:31
Fast Report "Fuera de memoria" BECERRA Impresión 0 25-12-2005 12:40:29


La franja horaria es GMT +2. Ahora son las 14:14:43.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi