Announcement

Collapse
No announcement yet.

WinAPI dcb type

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • WinAPI dcb type

    I have no problems setting any of the dcb parameters except the
    ones below. The PBDLL6.0 compiler gives me an error saying it's
    not a valid member. I looked in my win32api.inc and these are all
    part of the type. Any ideas what's going wrong?

    Best Regards

    Jim


    dim pconfig as dcb
    ''pconfig.fBinary=%true
    ''pconfig.fparity=%false
    ''pconfig.fOutxCtsFlow=%false
    ''pconfig.fOutxDsrFlow=%false
    ''pconfig.fDtrControl=%dtr_control_disable
    ''pconfig.fDsrSensitivity=%true
    ''pconfig.fTXContinueOnXoff=%true
    ''pconfig.fOutX=%false
    ''pconfig.fInX=%false
    ''pconfig.fErrorChar=%false
    ''pconfig.fNull=%false
    ''pconfig.fRtsControl=%rts_control_disable
    ''pconfig.fAbortOnError=%false


    ------------------
    Jim Seekamp
    Jim Seekamp

  • #2
    I think it's easy.

    This is the structure:

    Code:
    TYPE DCB
      DCBlength AS DWORD
      BaudRate AS DWORD
      fBits AS DWORD       ' fBinary
                           ' fParity
                           ' fOutxDtsFlow
                           ' fOutxDsrFlow
                           ' fDtrControl
                           ' fDsrSensitivity
                           ' fTXContinueOnXoff
                           ' fOutX
                           ' fInX
                           ' fErrorChar
                           ' fNull
                           ' fRtsControl
                           ' fAbortOnError
                           ' fDummy2
    
      wReserved AS INTEGER
      XonLim AS INTEGER
      XoffLim AS INTEGER
      ByteSize AS BYTE
      Parity AS BYTE
      StopBits AS BYTE
      XonChar AS BYTE
      XoffChar AS BYTE
      ErrorChar AS BYTE
      EofChar AS BYTE
      EvtChar AS BYTE
      wReserved2 AS INTEGER
    END TYPE
    You need to use fBits using 'Or' instead of sep. elements.



    ------------------
    [email protected]
    hellobasic

    Comment


    • #3
      My declaration reads:

      TYPE DCB
      DCBlength AS LONG
      BaudRate AS LONG
      fBinary AS LONG
      fParity AS LONG
      fOutxCtsFlow AS LONG
      fOutxDsrFlow AS LONG
      fDtrControl AS LONG
      fDsrSensitivity AS LONG
      fTXContinueOnXoff AS LONG
      fOutX AS LONG
      fInX AS LONG
      fErrorChar AS LONG
      fNull AS LONG
      fRtsControl AS LONG
      fAbortOnError AS LONG
      fDummy2 AS LONG
      wReserved AS INTEGER
      XonLim AS INTEGER
      XoffLim AS INTEGER
      ByteSize AS BYTE
      Parity AS BYTE
      StopBits AS BYTE
      XonChar AS BYTE
      XoffChar AS BYTE
      ErrorChar AS BYTE
      EofChar AS BYTE
      EvtChar AS BYTE
      END TYPE

      ????????


      ------------------
      Jim Seekamp
      Jim Seekamp

      Comment


      • #4
        I just looked at the latest Win32api.inc and I see the new declaration.
        How can you tell the bit position of the different settings in .fBits ?
        It seems a direct OR will not do the job; won't each separate value have to be read and compared?

        If the bits are consecutive, it would be this right?

        dim pconfig as dcb

        flags???=pconfig.fBits

        bit set flags???,0 ''pconfig.fBinary=%true
        bit reset flags???,1 ''pconfig.fparity=%false
        bit reset flags???,2 ''pconfig.fOutxCtsFlow=%false
        bit reset flags???,3 ''pconfig.fOutxDsrFlow=%false
        ''bit(flags???,4)=%dtr_control_disable ''pconfig.fDtrControl
        bit set flags???,5 ''pconfig.fDsrSensitivity=%true
        bit set flags???,6 ''pconfig.fTXContinueOnXoff=%true
        bit reset flags???,7 ''pconfig.fOutX=%false
        bit reset flags???,8 ''pconfig.fInX=%false
        bit reset flags???,9 ''pconfig.fErrorChar=%false
        bit reset flags???,10 ''pconfig.fNull=%false
        ''bit(flags???,11)=%rts_control_disable ''pconfig.fRtsControl
        bit reset flags???,12 ''pconfig.fAbortOnError=%false

        pconfig.fBits=flags???

        Thanks Edwin for the info.

        Best Regards

        Jim


        ------------------
        Jim Seekamp



        [This message has been edited by Jim Seekamp (edited August 24, 2000).]
        Jim Seekamp

        Comment


        • #5
          I guess:

          %DCB_fBinary = 1
          %DCB_fParity = 2
          %DCB_fOutxDtsFlow = 4
          %DCB_fOutxDsrFlow = 8
          etc:
          fDtrControl
          fDsrSensitivity
          fTXContinueOnXoff
          fOutX
          fInX
          fErrorChar
          fNull
          fRtsControl
          fAbortOnError
          fDummy2

          fBits = %DCB_fBinary Or %DCB_fParity

          I did not try it but you cert. should have luck with
          BITS(1) = 1
          BITS(2) = 0
          Etc..



          ------------------
          [email protected]
          hellobasic

          Comment


          • #6
            In the WinAPI, %rts_control_disable has possible values
            of 0,1, and 2 making it impossible for the bits to be
            consecutive. Does anyone know how this fBits dcb type
            member works??

            - Jim



            ------------------
            Jim Seekamp
            Jim Seekamp

            Comment


            • #7
              The MSDN library shows separate members for what the PB
              declaration calls fBits in dcb.
              "Communications Programming For Windows 95" by Charles Mirho
              also shows separate type members.
              Has PowerBasic customized these settings for their own custom type?
              If so, is there any documentation on how to use it?

              Best Regards

              Jim


              ------------------
              Jim Seekamp

              [This message has been edited by Jim Seekamp (edited August 25, 2000).]
              Jim Seekamp

              Comment


              • #8
                Jim,

                From the win32.hlp file, the fbits are assigned as follows:

                DWORD fBinary: 1; // binary mode, no EOF check
                DWORD fParity: 1; // enable parity checking
                DWORD fOutxCtsFlow:1; // CTS output flow control
                DWORD fOutxDsrFlow:1; // DSR output flow control
                DWORD fDtrControl:2; // DTR flow control type
                DWORD fDsrSensitivity:1; // DSR sensitivity
                DWORD fTXContinueOnXoff:1; // XOFF continues Tx
                DWORD fOutX: 1; // XON/XOFF out flow control
                DWORD fInX: 1; // XON/XOFF in flow control
                DWORD fErrorChar: 1; // enable error replacement
                DWORD fNull: 1; // enable null stripping
                DWORD fRtsControl:2; // RTS flow control
                DWORD fAbortOnError:1; // abort reads/writes on error
                DWORD fDummy2:17; // reserved

                and as you can see, Rts_Control is allowed 2 bits, which means that
                you can select 4 different values. And from Win32api.inc, these values are:

                %RTS_CONTROL_DISABLE = &H0
                %RTS_CONTROL_ENABLE = &H1
                %RTS_CONTROL_HANDSHAKE = &H2
                %RTS_CONTROL_TOGGLE = &H3

                So, I believe you just need to set those two bits to one of the above values.
                Hope this helps.

                ------------------


                [This message has been edited by Charles Dietz (edited August 25, 2000).]

                Comment


                • #9
                  Thanks! That helps immensely Charles.
                  (Where did you find that win32.hlp file?? I don't seem to have it.)

                  Best Regards

                  Jim


                  ------------------
                  Jim Seekamp
                  Jim Seekamp

                  Comment


                  • #10
                    jim,

                    here are some sites that should be helpful to you in choosing a
                    suitable link for downloading win32.hlp. i refer to this file so
                    often, i have a shortcut to it on my windows desktop.

                    http://www.powerbasic.com/support/pb...ead.php?t=2147
                    ftp://ftp.borland.com/pub/delphi/tec...phi2/win32.zip
                    ftp.powerbasic.com/pub/mstools/win32.hlp
                    http://www.cs.virginia.edu/~lcc-win32/ the one i use.

                    http://www.powerbasic.com/support/pb...ad.php?t=14499



                    the above powerbasic http sites are powerbasic windows forum threads.
                    for the ftp sites, you should copy and paste the addresses. otherwise,
                    if you just doubleclick the links, you'll get the message that netscape
                    can't find them, or at least i do.

                    as seen from the first two powerbasic forum threads, there has been
                    some difficulty in using the find feature with the win32.hlp file
                    downloaded from the powerbasic ftp site.

                    ------------------


                    [this message has been edited by charles dietz (edited august 25, 2000).]

                    Comment


                    • #11
                      As seen from the first two Powerbasic forum threads, there has been
                      some difficulty in using the FIND feature with the win32.hlp file
                      downloaded from the Powerbasic ftp site.
                      Actually only a very small number of people have had a problem with the Help File (which is a Microsoft file) and most of the time the solution centres arounf deleting the .GID and .FTS file, which are not always in the same folder as the .HLP file!

                      Usually applying the latest Windows service packs solves the issue if deleting the GID and FTS files does not. As a last resort, installing HCW32 usually fixes it. (HCW32 is the Microsoft Help Compiler, currently at version 4.03)

                      I must get onto writing an FAQ on this one!



                      ------------------
                      Lance
                      PowerBASIC Support
                      mailto:[email protected][email protected]</A>
                      Lance
                      mailto:[email protected]

                      Comment

                      Working...
                      X