Re: C# BitVector32 for DCB Struct - any help?

From: Jay B. Harlow [MVP - Outlook] (Jay_Harlow_MVP_at_msn.com)
Date: 07/14/04


Date: Wed, 14 Jul 2004 08:38:27 -0500

Chua Wen Ching,
> Can i reference your name, as you had been a great helper here?
If you feel its appropriate...

Jay

"Chua Wen Ching" <chua_wen_ching@nospam.hotmail.com> wrote in message
news:A07771DB-E2C2-40C9-A422-7EDA9B6FB14E@microsoft.com...
> Hi Jay B. Harlow,
>
> Wow. Thanks. I had understood it. I never thought it is based on enum.
>
> Yeah, is based on the greatest value in enum.
>
> Wow. It is greatest help i ever seen. I will note it down, and rewrite a
tutorial on this. Can i reference your name, as you had been a great helper
here?
>
> Coz i am writting a smart card small library tutorial pretty soon! Thanks
again.
> --
> Regards,
> Chua Wen Ching :)
>
>
> "Jay B. Harlow [MVP - Outlook]" wrote:
>
> >
> > Chua Wen Ching,
> > > my question is how do you the maximum value
> > > of fdtrcontrol or frtscontrol? Does msdn has the details?
> >
> > I use a combination of MSDN and the Windows include files (Windows.h).
The
> > fRtsControl has values Disable, Enable, Handshake & Toggle (0, 1, 2, 3)
> > while fDtrControl only has Disable, Enable, and Handshake (0, 1, 2).
> >
> > I use MSDN to find what is allowed, then I use Windows.h to find what
the
> > values of those items are. Hopefully you noticed that I defined an Enum
of
> > the DCB.RtsControl property that contains the above values...
> >
> > Hope this helps
> > Jay
> >
> >
> >
> >
> > "Chua Wen Ching" <chua_wen_ching@nospam.hotmail.com> wrote in message
> > news:09C68F33-E343-4F8C-9FAB-8C45E487DBD2@microsoft.com...
> > > Hi Jay,
> > >
> > > Thanks for the replies again.
> > >
> > > Ok i read and read but i still don't quite understand.
> > >
> > > This is from MSDN:
> > >
> >
> --------------------------------------------------------------------------
> > ------
> > > Parameters
> > > maxValue
> > > A 16-bit signed integer that specifies the maximum value for the new
> > BitVector32.Section.
> > > previous
> > > The previous BitVector32.Section in the BitVector32.
> > > =============================================
> > > A BitVector32.Section is a window into the BitVector32 and is composed
of
> > the smallest number of consecutive bits that can contain the maximum
value
> > specified in CreateSection. For example, a section with a maximum value
of 1
> > is composed of only one bit, whereas a section with a maximum value of 5
is
> > composed of three bits. You can create a BitVector32.Section with a
maximum
> > value of 1 to serve as a Boolean, thereby allowing you to store integers
and
> > Booleans in the same BitVector32.
> > >
> > > If sections already exist after previous in the BitVector32, those
> > sections are still accessible; however, overlapping sections might cause
> > unexpected results.
> >
> --------------------------------------------------------------------------
> > ------------------
> > > The thing which i don't quite understand is why the value is 2 of
> > RtsControl, you can maximize to 3.
> > > And why this:
> > >
> > > DWORD fDtrControl:2
> > >
> > > is equivalent to:
> > > m_fDtrControl = BitVector32.CreateSection(2, previousSection)
> > >
> > > and not 3, or 4 or 5...
> > >
> > > my question is how do you the maximum value of fdtrcontrol or
frtscontrol?
> > Does msdn has the details?
> > >
> > > I hope you get my question. But again thanks for the reply. :)
> > >
> > >
> > > --
> > > Regards,
> > > Chua Wen Ching :)
> > >
> > >
> > > "Jay B. Harlow [MVP - Outlook]" wrote:
> > >
> > > > Chua Wen Ching,
> > > > 1) Yes the order is related to the C structure.
> > > >
> > > > 2) Read the help again, specifically the NEXT page (from the one you
> > gave):
> > > >
> > > >
> >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemCollectionsSpecializedBitVector32ClassCreateSectionTopic1.asp
> > > >
> > > > 3) fDummy is filler, unless you have a need to fill it with
something,
> > yes
> > > > you can leave it off...
> > > >
> > > > Hope this helps
> > > > Jay
> > > >
> > > > "Chua Wen Ching" <chua_wen_ching@nospam.hotmail.com> wrote in
message
> > > > news:97C31DBE-0B45-44FF-898F-88B899081352@microsoft.com...
> > > > > Hi Jay,
> > > > >
> > > > > Thanks again. I had couple more questions to confirm.
> > > > >
> > > > > 1)
> > > > >
> > > > > The order here:
> > > > >
> > > > > Dim previousSection As BitVector32.Section
> > > > > previousSection = BitVector32.CreateSection(1)
> > > > > previousSection = BitVector32.CreateSection(1,
> > previousSection)
> > > > > previousSection = BitVector32.CreateSection(1,
> > previousSection)
> > > > > previousSection = BitVector32.CreateSection(1,
> > previousSection)
> > > > > m_fDtrControl = BitVector32.CreateSection(2,
previousSection)
> > > > > previousSection = BitVector32.CreateSection(1,
m_fDtrControl)
> > > > > previousSection = BitVector32.CreateSection(1,
> > previousSection)
> > > > > previousSection = BitVector32.CreateSection(1,
> > previousSection)
> > > > > previousSection = BitVector32.CreateSection(1,
> > previousSection)
> > > > > previousSection = BitVector32.CreateSection(1,
> > previousSection)
> > > > > previousSection = BitVector32.CreateSection(1,
> > previousSection)
> > > > > m_fRtsControl = BitVector32.CreateSection(3,
previousSection)
> > > > > previousSection = BitVector32.CreateSection(1,
m_fRtsControl)
> > > > >
> > > > > is related to the C structure (am i right?):
> > > > >
> > > > > DWORD fBinary: 1; /* Binary Mode (skip EOF check) */
> > > > > DWORD fParity: 1; /* Enable parity checking */
> > > > > DWORD fOutxCtsFlow:1; /* CTS handshaking on output */
> > > > > DWORD fOutxDsrFlow:1; /* DSR handshaking on output */
> > > > > DWORD fDtrControl:2; /* DTR Flow control */
> > > > > DWORD fDsrSensitivity:1; /* DSR Sensitivity */
> > > > > DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */
> > > > > DWORD fOutX: 1; /* Enable output X-ON/X-OFF */
> > > > > DWORD fInX: 1; /* Enable input X-ON/X-OFF */
> > > > > DWORD fErrorChar: 1; /* Enable Err Replacement */
> > > > > DWORD fNull: 1; /* Enable Null stripping */
> > > > > DWORD fRtsControl:2; /* Rts Flow control */
> > > > > DWORD fAbortOnError:1; /* Abort all reads and writes on Error
*/
> > > > > DWORD fDummy2:17; /* Reserved */
> > > > >
> > > > > 2)
> > > > >
> > > > > I can see the order, but hmm, why fRtsControl is still 3 instead
of 2.
> > > > >
> > > > > You say that:
> > > > >
> > > > > Read the help on the BitVector32CreateSection method, it takes the
max
> > > > value
> > > > > for that field. Hence 3.
> > > > > --> I had checked the msdn here
> > > > >
> > > > >
> > > >
> >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcollectionsspecializedbitvector32classcreatesectiontopic.asp
> > > > >
> > > > > I don't see it why it must be 3?
> > > > >
> > > > > 3) I notice you left out:
> > > > >
> > > > > DWORD fDummy 2:17;
> > > > >
> > > > > why? Can we just left out the bit flag just like that?
> > > > >
> > > > > Thanks for taking the time to reply. :)
> > > > > --
> > > > > Regards,
> > > > > Chua Wen Ching :)
> > > > >
> > > > >
> > > > > "Jay B. Harlow [MVP - Outlook]" wrote:
> > > > >
> > > > > > Chua Wen Ching,
> > > > > > > 1) Can you give me an example of vb.net of how you call that
> > > > structure?
> > > > > > Just say i want to assign value of true and false to each of
those.
> > > > > >
> > > > > > Dim dcb As DCB
> > > > > > dcb.Binary = true
> > > > > > dcb.DtrControl = DtrControl.Disable
> > > > > >
> > > > > > If dcb.Binary Then
> > > > > > ' do something exciting
> > > > > > End if
> > > > > >
> > > > > > > 2) I still not sure why is shared sub New(), there, why can't
i
> > > > initialize
> > > > > > everything inside the structure, example:
> > > > > >
> > > > > > Two reasons:
> > > > > > 1 - the previousSection local variable
> > > > > > 2 - the static constructor ensures on the order of the
> > > > initialization
> > > > > > (both in relation to each field and in relation to any
> > constructors).
> > > > > >
> > > > > > Also I rarely using field initialization for member fields, I
almost
> > > > always
> > > > > > use constructors to initialize member fields. However local
> > variables I
> > > > will
> > > > > > use initialization on...
> > > > > >
> > > > > > > Why is there so many repeated code here?
> > > > > > Look at the C++ structure fDtrControl is in the 5 bit, if you
skip
> > the
> > > > first
> > > > > > 4 CreateSections, then fDtrControl would be in the first bit.
> > > > > >
> > > > > >
> > > > > > > I also curious, that fRtsControl contains the value of 2, why
will
> > you
> > > > > > place it as value 3?
> > > > > > Read the help on the BitVector32CreateSection method, it takes
the
> > max
> > > > value
> > > > > > for that field. Hence 3.
> > > > > >
> > > > > >
> > > > > > Hope this helps
> > > > > > Jay
> > > > > >
> > > > > >
> > > > > > "Chua Wen Ching" <chua_wen_ching@nospam.hotmail.com> wrote in
> > message
> > > > > > news:8BD188CD-AF86-4CA3-9585-98995124BC91@microsoft.com...
> > > > > > > Hi Jay,
> > > > > > >
> > > > > > > I had 4 more questions on the previous threads. I wll copy
paste
> > it
> > > > here
> > > > > > again:
> > > > > > >
> > > > > > > 1) Can you give me an example of vb.net of how you call that
> > > > structure?
> > > > > > Just say i want to assign value of true and false to each of
those.
> > > > > > >
> > > > > > > Please help! I am trying to think how to use it in my client
app
> > side.
> > > > > > >
> > > > > > > 2) I still not sure why is shared sub New(), there, why can't
i
> > > > initialize
> > > > > > everything inside the structure, example:
> > > > > > >
> > > > > > > private shared readonly m_fbinary as integer =
> > > > BitVector32.CreateMask()
> > > > > > >
> > > > > > > rather than inside a sub New()
> > > > > > >
> > > > > > > 3)
> > > > > > > Why is there so many repeated code here?
> > > > > > >
> > > > > > > Is there any purpose why you do that?
> > > > > > >
> > > > > > > Dim previousSection As BitVector32.Section
> > > > > > > previousSection = BitVector32.CreateSection(1)
> > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > previousSection)
> > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > previousSection)
> > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > previousSection)
> > > > > > > m_fDtrControl = BitVector32.CreateSection(2,
> > previousSection)
> > > > > > > previousSection = BitVector32.CreateSection(1,
> > m_fDtrControl)
> > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > previousSection)
> > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > previousSection)
> > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > previousSection)
> > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > previousSection)
> > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > previousSection)
> > > > > > > m_fRtsControl = BitVector32.CreateSection(3,
> > previousSection)
> > > > > > > previousSection = BitVector32.CreateSection(1,
> > m_fRtsControl)
> > > > > > >
> > > > > > > and not this?
> > > > > > >
> > > > > > > Dim previousSection As BitVector32.Section
> > > > > > > previousSection = BitVector32.CreateSection(1)
> > > > > > >
> > > > > > > m_fDtrControl = BitVector32.CreateSection(2,
> > previousSection)
> > > > > > >
> > > > > > > m_fRtsControl = BitVector32.CreateSection(3,
> > previousSection)
> > > > > > > previousSection = BitVector32.CreateSection(1,
> > m_fRtsControl)
> > > > > > >
> > > > > > > 4)
> > > > > > > I also curious, that fRtsControl contains the value of 2, why
will
> > you
> > > > > > place it as value 3?
> > > > > > >
> > > > > > > Thanks a lot.
> > > > > > > --
> > > > > > > Regards,
> > > > > > > Chua Wen Ching :)
> > > > > > >
> > > > > > >
> > > > > > > "Jay B. Harlow [MVP - Outlook]" wrote:
> > > > > > >
> > > > > > > > Chua,
> > > > > > > > > I even email you through your blog.
> > > > > > > > I do not respond to private emails. If I did respond to a
> > private
> > > > email
> > > > > > only
> > > > > > > > you would benefit, others wanting to know the answer will
not
> > see
> > > > it.
> > > > > > Thanks
> > > > > > > > for understanding.
> > > > > > > >
> > > > > > > > > 1) How do i get Flags.Item()?
> > > > > > > > In VB.NET Item is the indexer, VB.NET allows including or
> > excluding
> > > > Item
> > > > > > > >
> > > > > > > > return (RtsControl) Flags[m_fRtsControl]
> > > > > > > >
> > > > > > > > > 2) In the FXCop rules, it recommends me not to use the
static
> > void
> > > > > > New(),
> > > > > > > >
> > > > > > > > Are you calling it "New" or are you calling it DCB? "Shared
Sub
> > New"
> > > > is
> > > > > > a
> > > > > > > > static constructor you need to use valid C# syntax for the
> > static
> > > > > > > > constructors (I believe it should be "static DCB()").
> > > > > > > >
> > > > > > > > My sample "requires" a static constructor I'm not sure why
FXCop
> > > > would
> > > > > > > > complain about a static constructor...
> > > > > > > >
> > > > > > > > > 3)
> > > > > > > > >
> > > > > > > > > -> in C#
> > > > > > > >
> > > > > > > > > return (RtsControl) Flags[m_fRtsControl]
> > > > > > > >
> > > > > > > >
> > > > > > > > > a) first it can't identify Flags.Item
> > > > > > > > > b) second, cannot cast from BitVector to RtsControl, i
assume
> > > > > > RtsControl
> > > > > > > > is a enum
> > > > > > > > RtsControl is an enum...
> > > > > > > >
> > > > > > > > Hope this helps
> > > > > > > > Jay
> > > > > > > >
> > > > > > > > "Chua Wen Ching" <chua_wen_ching@nospam.hotmail.com> wrote
in
> > > > message
> > > > > > > > news:120436C2-3B7A-4D9F-A9E1-0587D95A7B16@microsoft.com...
> > > > > > > > > Hi Jay,
> > > > > > > > >
> > > > > > > > > Thanks a lot. I read all those threads already. I even
email
> > you
> > > > > > through
> > > > > > > > your blog.
> > > > > > > > >
> > > > > > > > > Ok i had a few doubts:
> > > > > > > > >
> > > > > > > > > 1) How do i get Flags.Item()?
> > > > > > > > >
> > > > > > > > > When i do this:
> > > > > > > > >
> > > > > > > > > BitVector Flags;
> > > > > > > > >
> > > > > > > > > Flags.(intellisense, i can't find Item() ).. any idea?
Thanks.
> > > > > > > > >
> > > > > > > > > 2)
> > > > > > > > >
> > > > > > > > > In the FXCop rules, it recommends me not to use the static
> > void
> > > > New(),
> > > > > > ask
> > > > > > > > me to prevent to use static inside structure. Any idea why?
Coz
> > you
> > > > used
> > > > > > > > shared sub new().
> > > > > > > > >
> > > > > > > > > 3)
> > > > > > > > >
> > > > > > > > > Return CType(Flags.Item(m_fRtsControl), RtsControl)
> > > > > > > > >
> > > > > > > > > -> in C#, suppose to be:
> > > > > > > > >
> > > > > > > > > return (RtsControl) Flags.Item(m_fRtsControl) ???
> > > > > > > > >
> > > > > > > > > a) first it can't identify Flags.Item
> > > > > > > > > b) second, cannot cast from BitVector to RtsControl, i
assume
> > > > > > RtsControl
> > > > > > > > is a enum
> > > > > > > > >
> > > > > > > > > Thanks for the help!
> > > > > > > > > --
> > > > > > > > > Regards,
> > > > > > > > > Chua Wen Ching :)
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > "Jay B. Harlow [MVP - Outlook]" wrote:
> > > > > > > > >
> > > > > > > > > > Chua Wen Ching,
> > > > > > > > > > Have you looked at this thread?
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=eJBe%241DlDHA.2500%40TK2MSFTNGP10.phx.gbl&rnum=7&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%
> > > > > >
> > > >
> >
26q%3DfBinary%253A1%26btnG%3DSearch%26meta%3Dgroup%253Dmicrosoft.public.dotn
> > > > > > et.*
> > > > > > > > > >
> > > > > > > > > > Here is my complete DCB structure in VB.NET:
> > > > > > > > > >
> > > > > > > > > > Option Strict On
> > > > > > > > > > Option Explicit On
> > > > > > > > > >
> > > > > > > > > > Imports System.Collections.Specialized
> > > > > > > > > > Imports System.Runtime.InteropServices
> > > > > > > > > >
> > > > > > > > > > Public Enum DtrControl As Byte
> > > > > > > > > > Disable = &H0
> > > > > > > > > > Enable = &H1
> > > > > > > > > > Handshake = &H2
> > > > > > > > > > End Enum
> > > > > > > > > >
> > > > > > > > > > Public Enum RtsControl As Byte
> > > > > > > > > > Disable = &H0
> > > > > > > > > > Enable = &H1
> > > > > > > > > > Handshake = &H2
> > > > > > > > > > Toggle = &H3
> > > > > > > > > > End Enum
> > > > > > > > > >
> > > > > > > > > > Public Enum Parity As Byte
> > > > > > > > > > None = 0
> > > > > > > > > > Odd = 1
> > > > > > > > > > Even = 2
> > > > > > > > > > Mark = 3
> > > > > > > > > > Space = 4
> > > > > > > > > > End Enum
> > > > > > > > > >
> > > > > > > > > > Public Enum StopBits As Byte
> > > > > > > > > > One = 0
> > > > > > > > > > One5 = 1
> > > > > > > > > > Two = 2
> > > > > > > > > > End Enum
> > > > > > > > > >
> > > > > > > > > > <StructLayout(LayoutKind.Sequential)> _
> > > > > > > > > > Public Structure DCB
> > > > > > > > > >
> > > > > > > > > > Public Size As Int32
> > > > > > > > > > Public BaudRate As Int32
> > > > > > > > > > Private Flags As BitVector32
> > > > > > > > > > Private Reserved As Int16
> > > > > > > > > > Public XonLim As Int16
> > > > > > > > > > Public XoffLim As Int16
> > > > > > > > > > Public ByteSize As Byte
> > > > > > > > > > Public Parity As Parity
> > > > > > > > > > Public StopBits As StopBits
> > > > > > > > > > Public XonChar As Byte
> > > > > > > > > > Public XoffChar As Byte
> > > > > > > > > > Public ErrorChar As Byte
> > > > > > > > > > Public EofChar As Byte
> > > > > > > > > > Public EvtChar As Byte
> > > > > > > > > >
> > > > > > > > > > Private Reserved1 As Int16
> > > > > > > > > >
> > > > > > > > > > #Region " Shared Flags support "
> > > > > > > > > >
> > > > > > > > > > Private Shared ReadOnly m_fBinary As Integer
> > > > > > > > > > Private Shared ReadOnly m_fParity As Integer
> > > > > > > > > > Private Shared ReadOnly m_fOutxCtsFlow As Integer
> > > > > > > > > > Private Shared ReadOnly m_fOutxDsrFlow As Integer
> > > > > > > > > > Private Shared ReadOnly m_fDtrControl As
> > BitVector32.Section
> > > > > > > > > > Private Shared ReadOnly m_fDsrSensitivity As Integer
> > > > > > > > > > Private Shared ReadOnly m_fTXContinueOnXoff As
Integer
> > > > > > > > > > Private Shared ReadOnly m_fOutX As Integer
> > > > > > > > > > Private Shared ReadOnly m_fInX As Integer
> > > > > > > > > > Private Shared ReadOnly m_fErrorChar As Integer
> > > > > > > > > > Private Shared ReadOnly m_fNull As Integer
> > > > > > > > > > Private Shared ReadOnly m_fRtsControl As
> > BitVector32.Section
> > > > > > > > > > Private Shared ReadOnly m_fAbortOnError As Integer
> > > > > > > > > >
> > > > > > > > > > Shared Sub New()
> > > > > > > > > > ' Create boolean masks
> > > > > > > > > > Dim previosMask As Integer
> > > > > > > > > > m_fBinary = BitVector32.CreateMask()
> > > > > > > > > > m_fParity = BitVector32.CreateMask(m_fBinary)
> > > > > > > > > > m_fOutxCtsFlow =
BitVector32.CreateMask(m_fParity)
> > > > > > > > > > m_fOutxDsrFlow =
> > BitVector32.CreateMask(m_fOutxCtsFlow)
> > > > > > > > > > previosMask =
BitVector32.CreateMask(m_fOutxDsrFlow)
> > > > > > > > > > previosMask =
BitVector32.CreateMask(previosMask)
> > > > > > > > > > m_fDsrSensitivity =
> > BitVector32.CreateMask(previosMask)
> > > > > > > > > > m_fTXContinueOnXoff =
> > > > > > BitVector32.CreateMask(m_fDsrSensitivity)
> > > > > > > > > > m_fOutX =
> > BitVector32.CreateMask(m_fTXContinueOnXoff)
> > > > > > > > > > m_fInX = BitVector32.CreateMask(m_fOutX)
> > > > > > > > > > m_fErrorChar = BitVector32.CreateMask(m_fInX)
> > > > > > > > > > m_fNull = BitVector32.CreateMask(m_fErrorChar)
> > > > > > > > > > previosMask = BitVector32.CreateMask(m_fNull)
> > > > > > > > > > previosMask =
BitVector32.CreateMask(previosMask)
> > > > > > > > > > m_fAbortOnError =
> > BitVector32.CreateMask(previosMask)
> > > > > > > > > >
> > > > > > > > > > ' Create section masks
> > > > > > > > > > Dim previousSection As BitVector32.Section
> > > > > > > > > > previousSection = BitVector32.CreateSection(1)
> > > > > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > > > previousSection)
> > > > > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > > > previousSection)
> > > > > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > > > previousSection)
> > > > > > > > > > m_fDtrControl = BitVector32.CreateSection(2,
> > > > > > previousSection)
> > > > > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > > > m_fDtrControl)
> > > > > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > > > previousSection)
> > > > > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > > > previousSection)
> > > > > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > > > previousSection)
> > > > > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > > > previousSection)
> > > > > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > > > previousSection)
> > > > > > > > > > m_fRtsControl = BitVector32.CreateSection(3,
> > > > > > previousSection)
> > > > > > > > > > previousSection = BitVector32.CreateSection(1,
> > > > > > m_fRtsControl)
> > > > > > > > > > End Sub
> > > > > > > > > >
> > > > > > > > > > #End Region
> > > > > > > > > >
> > > > > > > > > > 'DWORD fBinary :1;
> > > > > > > > > > Public Property Binary() As Boolean
> > > > > > > > > > Get
> > > > > > > > > > Return Flags.Item(m_fBinary)
> > > > > > > > > > End Get
> > > > > > > > > > Set(ByVal value As Boolean)
> > > > > > > > > > Flags.Item(m_fBinary) = value
> > > > > > > > > > End Set
> > > > > > > > > > End Property
> > > > > > > > > >
> > > > > > > > > > 'DWORD fParity :1;
> > > > > > > > > > Public Property CheckParity() As Boolean
> > > > > > > > > > Get
> > > > > > > > > > Return Flags.Item(m_fParity)
> > > > > > > > > > End Get
> > > > > > > > > > Set(ByVal value As Boolean)
> > > > > > > > > > Flags.Item(m_fParity) = value
> > > > > > > > > > End Set
> > > > > > > > > > End Property
> > > > > > > > > >
> > > > > > > > > > 'DWORD fOutxCtsFlow :1;
> > > > > > > > > > Public Property OutxCtsFlow() As Boolean
> > > > > > > > > > Get
> > > > > > > > > > Return Flags.Item(m_fOutxCtsFlow)
> > > > > > > > > > End Get
> > > > > > > > > > Set(ByVal value As Boolean)
> > > > > > > > > > Flags.Item(m_fOutxCtsFlow) = value
> > > > > > > > > > End Set
> > > > > > > > > > End Property
> > > > > > > > > >
> > > > > > > > > > 'DWORD fOutxDsrFlow :1;
> > > > > > > > > > Public Property OutxDsrFlow() As Boolean
> > > > > > > > > > Get
> > > > > > > > > > Return Flags.Item(m_fOutxDsrFlow)
> > > > > > > > > > End Get
> > > > > > > > > > Set(ByVal value As Boolean)
> > > > > > > > > > Flags.Item(m_fOutxDsrFlow) = value
> > > > > > > > > > End Set
> > > > > > > > > > End Property
> > > > > > > > > >
> > > > > > > > > > 'DWORD fDtrControl :2;
> > > > > > > > > > Public Property DtrControl() As DtrControl
> > > > > > > > > > Get
> > > > > > > > > > Return CType(Flags.Item(m_fDtrControl),
> > DtrControl)
> > > > > > > > > > End Get
> > > > > > > > > > Set(ByVal value As DtrControl)
> > > > > > > > > > Flags.Item(m_fDtrControl) = value
> > > > > > > > > > End Set
> > > > > > > > > > End Property
> > > > > > > > > >
> > > > > > > > > > 'DWORD fDsrSensitivity :1;
> > > > > > > > > > Public Property DsrSensitivity() As Boolean
> > > > > > > > > > Get
> > > > > > > > > > Return Flags.Item(m_fDsrSensitivity)
> > > > > > > > > > End Get
> > > > > > > > > > Set(ByVal value As Boolean)
> > > > > > > > > > Flags.Item(m_fDsrSensitivity) = value
> > > > > > > > > > End Set
> > > > > > > > > > End Property
> > > > > > > > > >
> > > > > > > > > > 'DWORD fTXContinueOnXoff :1;
> > > > > > > > > > Public Property TxContinueOnXoff() As Boolean
> > > > > > > > > > Get
> > > > > > > > > > Return Flags.Item(m_fTXContinueOnXoff)
> > > > > > > > > > End Get
> > > > > > > > > > Set(ByVal value As Boolean)
> > > > > > > > > > Flags.Item(m_fTXContinueOnXoff) = value
> > > > > > > > > > End Set
> > > > > > > > > > End Property
> > > > > > > > > >
> > > > > > > > > > 'DWORD fOutX :1;
> > > > > > > > > > Public Property OutX() As Boolean
> > > > > > > > > > Get
> > > > > > > > > > Return Flags.Item(m_fOutX)
> > > > > > > > > > End Get
> > > > > > > > > > Set(ByVal value As Boolean)
> > > > > > > > > > Flags.Item(m_fOutX) = value
> > > > > > > > > > End Set
> > > > > > > > > > End Property
> > > > > > > > > >
> > > > > > > > > > 'DWORD fInX :1;
> > > > > > > > > > Public Property InX() As Boolean
> > > > > > > > > > Get
> > > > > > > > > > Return Flags.Item(m_fInX)
> > > > > > > > > > End Get
> > > > > > > > > > Set(ByVal value As Boolean)
> > > > > > > > > > Flags.Item(m_fInX) = value
> > > > > > > > > > End Set
> > > > > > > > > > End Property
> > > > > > > > > >
> > > > > > > > > > 'DWORD fErrorChar :1;
> > > > > > > > > > Public Property ReplaceErrorChar() As Boolean
> > > > > > > > > > Get
> > > > > > > > > > Return Flags.Item(m_fErrorChar)
> > > > > > > > > > End Get
> > > > > > > > > > Set(ByVal value As Boolean)
> > > > > > > > > > Flags.Item(m_fErrorChar) = value
> > > > > > > > > > End Set
> > > > > > > > > > End Property
> > > > > > > > > >
> > > > > > > > > > 'DWORD fNull :1;
> > > > > > > > > > Public Property Null() As Boolean
> > > > > > > > > > Get
> > > > > > > > > > Return Flags.Item(m_fNull)
> > > > > > > > > > End Get
> > > > > > > > > > Set(ByVal value As Boolean)
> > > > > > > > > > Flags.Item(m_fNull) = value
> > > > > > > > > > End Set
> > > > > > > > > > End Property
> > > > > > > > > >
> > > > > > > > > > 'DWORD fRtsControl :2;
> > > > > > > > > > Public Property RtsControl() As RtsControl
> > > > > > > > > > Get
> > > > > > > > > > Return CType(Flags.Item(m_fRtsControl),
> > RtsControl)
> > > > > > > > > > End Get
> > > > > > > > > > Set(ByVal value As RtsControl)
> > > > > > > > > > Flags.Item(m_fRtsControl) = value
> > > > > > > > > > End Set
> > > > > > > > > > End Property
> > > > > > > > > >
> > > > > > > > > > 'DWORD fAbortOnError :1;
> > > > > > > > > > Public Property AbortOnError() As Boolean
> > > > > > > > > > Get
> > > > > > > > > > Return Flags.Item(m_fAbortOnError)
> > > > > > > > > > End Get
> > > > > > > > > > Set(ByVal value As Boolean)
> > > > > > > > > > Flags.Item(m_fAbortOnError) = value
> > > > > > > > > > End Set
> > > > > > > > > > End Property
> > > > > > > > > >
> > > > > > > > > > End Structure
> > > > > > > > > >
> > > > > > > > > > The VB.NET code should be easily converted to C#, post
if
> > you
> > > > need
> > > > > > help.
> > > > > > > > > >
> > > > > > > > > > Hope this helps
> > > > > > > > > > Jay
> > > > > > > > > >
> > > > > > > > > > "Chua Wen Ching" <chua_wen_ching@nospam.hotmail.com>
wrote
> > in
> > > > > > message
> > > > > > > > > >
news:C569B72B-5ABB-4AAF-A8BA-CF175B044AAB@microsoft.com...
> > > > > > > > > > > Hi there,
> > > > > > > > > > >
> > > > > > > > > > > I saw this article here in vb.net.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
http://www.error-bank.com/microsoft.public.dotnet.languages.vb.1/148992_Thread.aspx
> > > > > > > > > > >
> > > > > > > > > > > and
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
http://www.opennetcf.org/forums/post.asp?method=ReplyQuote&REPLY_ID=3922&TOPIC_ID=2224&FORUM_ID=35
> > > > > > > > > > >
> > > > > > > > > > > But i had a question.
> > > > > > > > > > >
> > > > > > > > > > > Can anyone show me how to code the part, for example:
> > > > > > > > > > >
> > > > > > > > > > > DWORD fBinary:1;
> > > > > > > > > > > DWORD fParity:1;
> > > > > > > > > > > DWORD fOutxCtsFlow:1;
> > > > > > > > > > > DWORD fOutxDsrFlow:1;
> > > > > > > > > > > DWORD fDtrControl:2;
> > > > > > > > > > > ...
> > > > > > > > > > > ...
> > > > > > > > > > >
> > > > > > > > > > > I am not that sure. If more examples, i will know what
to
> > do
> > > > next.
> > > > > > Coz
> > > > > > > > the
> > > > > > > > > > author just skip off to RTS.
> > > > > > > > > > >
> > > > > > > > > > > Please help! Thanks.
> > > > > > > > > > > --
> > > > > > > > > > > Regards,
> > > > > > > > > > > Chua Wen Ching :)
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > > >
> >
> >
> >



Relevant Pages

  • Re: C# BitVector32 for DCB Struct - any help?
    ... - the static constructor ensures on the order of the initialization ... Also I rarely using field initialization for member fields, ... > Dim previousSection As BitVector32.Section ... > Chua Wen Ching:) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: C# BitVector32 for DCB Struct - any help?
    ... I use a combination of MSDN and the Windows include files. ... while fDtrControl only has Disable, Enable, and Handshake. ... > Chua Wen Ching:) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: C# BitVector32 for DCB Struct - any help?
    ... is based on the greatest value in enum. ... Chua Wen Ching:) ... > I use a combination of MSDN and the Windows include files. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: C# BitVector32 for DCB Struct - any help?
    ... > Dim previousSection As BitVector32.Section ... > Chua Wen Ching:) ... >> use constructors to initialize member fields. ...
    (microsoft.public.dotnet.languages.csharp)