FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bug in comm.c
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Bug in comm.c

Posted: Sat Dec 24, 2005 02:15 PM
The following sample freezes with the latest FWH (it worked ok with a previous FWH release):

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oGet, cTxt := ""

    LOCAL nCom

    DEFINE DIALOG oDlg;
           SIZE 500, 500;
           TITLE "Terminal"

    @ 0, 0 GET oGet VAR cTxt MEMO

    oGet:bKeyDown = { | nKey | Tasti( nCom, nKey ) }
    oGet:bKeyChar = { | nKey | 0 }

    ACTIVATE DIALOG oDlg;
             ON INIT ( oGet:Move( 0, 0, 500, 500 ),;
                       nCom := APRICOM( oDlg, oGet ),;
                       IF( nCom < 0, oDlg:End(), ) );
             CENTER

    IF nCom >= 0; CLOSECOMM( nCom ); ENDIF

    RETURN NIL


STATIC FUNCTION TASTI( nCom, nKey )

    SENDSTR( nCom, CHR( nKey ) )

    RETURN NIL


STATIC FUNCTION APRICOM( oDlg, oGet )

    LOCAL nCom, cDcb

    BEGIN SEQUENCE
        nCom = OPENCOMM( "COM1", 16384, 16384 )

        IF nCom < 0
            ? "Errore di apertura della porta di comunicazione."
            BREAK
        ENDIF

        BUILDCOMMDCB( "COM1:115200,N,8,1", @cDcb )

        IF !SETCOMMSTATE( cDcb )
            ? "Errore di impostazione della porta di comunicazione."
            BREAK
        ENDIF

        oDlg:bCommNotify = { | nCom | Connect( nCom, oGet ),;
                                      EnableCommNotification( nCom, oDlg:hWnd, 1, -1 ) }

        IF !ENABLECOMMNOTIFICATION( nCom, oDlg:hWnd, 1, -1 )
            ? "Errore di abilitazione della notifica."
            BREAK
        ENDIF
    RECOVER
        nCom = -1
    END SEQUENCE

    RETURN nCom


STATIC FUNCTION CONNECT( nCom, oGet )

    ENABLECOMMNOTIFICATION( nCom, 0, 1, -1 )

    oGet:Append( RECEIVESTR( nCom ) )

    RETURN NIL


STATIC FUNCTION SENDSTR( nCom, cString )

    LOCAL nBytes := WRITECOMM( nCom, cString )

    RETURN nBytes = 0 .OR. nBytes = LEN( cString )


STATIC FUNCTION RECEIVESTR( nCom )

    LOCAL cBuf := SPACE( 1000 )

    RETURN LEFT( cBuf, READCOMM( nCom, @cBuf ) )


EMG
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Bug in comm.c

Posted: Sat Dec 24, 2005 05:17 PM

Enrico,

FWH COMM functions are still buggy. They should not be used :(

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Bug in comm.c

Posted: Sat Dec 24, 2005 05:22 PM

It maybe but it seems to be worst in the latest release. I can send you the latest working comm.c if you want.

EMG

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Bug in comm.c

Posted: Sat Dec 24, 2005 05:38 PM

Enrico,

Yes, please email me the comm.c that was working for you. Thanks.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Bug in comm.c

Posted: Sat Dec 24, 2005 05:51 PM

Enrico,

Yes, please replace the actual comm.c with the previous one. We thought it was going to provide a better functionality, but no, things get worse.

I don't want to blame MS but I can't understand how they don't provide this functionality built-in as it was on 16 bits, same as there is no a DrawBitmap() for a GUI since the early days of Windows...

Thats why we were doing some research on mscomm32.ocx

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Bug in comm.c

Posted: Sat Dec 24, 2005 06:13 PM
Antonio Linares wrote:Enrico,

Yes, please replace the actual comm.c with the previous one. We thought it was going to provide a better functionality, but no, things get worse.


I already done so. :-)

I don't want to blame MS but I can't understand how they don't provide this functionality built-in as it was on 16 bits, same as there is no a DrawBitmap() for a GUI since the early days of Windows...


I agree. The MS guy who designed the API layer did not make a good work for me.

Thats why we were doing some research on mscomm32.ocx


I would prefer the current APIs that don't need any additional component.

EMG
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Bug in comm.c

Posted: Sat Dec 24, 2005 07:18 PM

Enrico,

> I would prefer the current APIs that don't need any additional component.

Me too.

Anyhow, lets work to properly implement COMM support for 32 bits.

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion