buildcommdcb (kernel32)
Last changed: tonedef-216.207.3.197

.
Summary

C# Signature:

[DllImport("kernel32.dll")]
static extern bool BuildCommDCB(string lpDef, [Out] ref DCB lpDCB);

User-Defined Types:

None.

Notes:

Note that to use this function you have to prepare dcb structure (see at pinvoke.net)

Tips & Tricks:

Please add some!

Dcb dcb = new Dcb();

dcb.DCBLength = (uint)System.Runtime.InteropServices.Marshal.SizeOf(dcb);

dcb.Binary = true;

string portParams = "baud="BoudRate.ToString()" parity="ParityDB.ToString()" data="DataBit.ToString()" stop="+StopBit.ToString();

if (!BuildCommDCB(portParams, ref dcb))

{

    MessageBox.Show("Error: BuildComm()");
    return  (IntPtr)INVALID_HANDLE_VALUE;

}

Alternative Managed API:

Do you know one? Please contribute it!

Documentation