Send string across pipes

Send string across pipes

Postby goosfancito » Tue Jul 11, 2006 4:22 pm

Hi friend,

i have this code:

Code: Select all  Expand view  RUN
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.-
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 34 guests