Send string across pipes

Post Reply
User avatar
goosfancito
Posts: 1392
Joined: Fri Oct 07, 2005 7:08 pm

Send string across pipes

Post by goosfancito »

Hi friend,

i have this code:

Code: Select all

FUNCTION main()
   LOCAL oDlg
   LOCAL oIcono
   LOCAL hPipe

   LOCAL xDatoLeido

   LOCAL oBtns      := Array( 01 )
   LOCAL oDatos     := Array( 01 )
   LOCAL vDatos     := Array( 01 )
   LOCAL NombrePipe := "\\\\.\\pipe\\gustavo"

   vDatos[ 01 ]:= Space( 45 )

   SET( _SET_INSERT, ! Set( _SET_INSERT ) )

   DEFINE icon oIcono resource "ico_copa"

   DEFINE DIALOG oDlg resource "DLG_PIPE" icon oIcono

      REDEFINE GET oDatos[ 01 ] VAR vDatos[ 01 ] ID 100 OF oDlg

      REDEFINE BUTTON oBtns[ 01 ] ID 200 OF oDlg

      //----------( Controlo los botones )----------

      oBtns[ 01 ]: bAction:= { || EnviarComando( NombrePipe,;
                                                 "hola",;
                                                 len( "hola" ),;
                                                 xDatoLeido,;
                                                 len( xDatoLeido ),;
                                                 20000,;
                                                )}

   ACTIVATE DIALOG oDlg

RETURN ( NIL )

//------------------------------------------------------------------------------

DLL32 FUNCTION EnviarComando;
      ( lpNamedPipeName AS STRING, ;
        @lpInBuffer AS LPSTR, ;
        nInBufferSize AS LONG, ;
        @lpOutBuffer AS LPSTR, ;
        nOutBufferSize AS LONG, ;
        @lpBytesRead AS LONG, ;
        nTimeOut AS LONG ) ;
   AS LONG PASCAL;
   FROM "CallNamedPipeA" LIB "KERNEL32"

//------------------------------------------------------------------------------
Why don´t send string HOLA?, the pipe: "\\\\.\\pipe\\gustavo" exist.

Tank.-
Un aporte chico hace grandes cambios.
Apoyemos al proyecto "Hogar pimpinela"
Bajate la aplicación (gratuita) y encuentra en ella toda la info de como podes colaborar.
GRACIAS!
https://play.google.com/store/apps/deta ... .acomprar
Post Reply