Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!rocksanne!news
From: Ray Wong <h2o@magic.ca>
Subject: Re: Win32 API problems using Visual Smalltalk V3.0.1...... help!!!
Content-Type: text/plain; charset=us-ascii
Message-ID: <30A3C810.1923@magic.ca>
Sender: news@news.wrc.xerox.com
Content-Transfer-Encoding: 7bit
Organization: xerox
References: <30A13499.57DF@magic.ca>
Mime-Version: 1.0
Date: Fri, 10 Nov 1995 21:45:52 GMT
X-Mailer: Mozilla 2.0b2 (Windows; I; 32bit)
Lines: 48

Well, I solved my own problem.....
And I just thought I'd share it with everyone here so that some of you don't have to
go through the same pain I did.

My problems started when I was trying to implement a Serial interface for Digtalk's 
Visual Smalltalk.  According to the Win32 SDK manual I have to use the DCB structure.
Now the interesting thing about the DCB structure is that it has some binary flags
in it... ( see below )

typedef struct _DCB { /* dcb */
    DWORD DCBlength;           /* sizeof(DCB)                */
    DWORD BaudRate;            /* current baud rate          */
    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       */

< stuff removed....>

    char ErrorChar;        /* error replacement character    */
    char EofChar;          /* end of input character         */

    char EvtChar;          /* received event character       */
} DCB;

Anyway, see all those DWORDs besides every fXXXX entry in the structure?? Well I thought that 
according to description, EACH flag takes up a DWORD in this structure.  ( I am I the only one who 
fell for this?? ) Well, it does NOT!!  If you look after the flag label, there is a colon and a 
number, the number is the number of bits this data takes up IN a DWORD.

Also, the ORDER in which these bits are packed into a DWORD is of course important, thru 
experimentation, I have found that the LSB of the DWORD will represent fBinary, and so on...

Any to make a long story short, I now have a fully functioning serial interface for VS 3.0.1 if 
there is anyone out there who would like a serial interface, drop me a line and I'll see if I can 
e-mail what I have done so far to you.   As for the future, as part of my project, that I had to 
develop this interface, I'll be turning the interface into a PARTS.

	Stay tuned.....

		Ray Wong ( h2o@magic.ca )
