Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to call to MAIN

How to call to MAIN

Scheduled Pinned Locked Moved C#
csharphelpvisual-studiojsontutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    levis
    wrote on last edited by
    #1

    Hi all!i am using microsoft visual studio.net 2003.i have create a class for communication with serial port via RS-232.It contains read and write function.i run this in the console application.Class 1 is all the function and class 2 is my MAIN.i use Main to call the read and write function.Can someone please please help me how i can read unlimited bytes?How to call the Public MemoryStream Read(int bufSize) to my MAIN?I try it so many time but still fail to do it..Please please help me..Thanks a lot! This is my Class 1 using System; using System.Runtime.InteropServices; using System.IO; using System.Text; using System.Globalization; using System.Threading; namespace yong { public class port { /*-- Definition of variables by Programmer --*/ /*-- Setting win32 API constants --*/ private const uint GENERIC_READ = 0x80000000; private const uint GENERIC_WRITE = 0x40000000; private const int CREATE_ALWAYS = 2; private const int INVALID_HANDLE_VALUE = -1; /*-- End ofSetting win32 API constants --*/ public int PortNum = 1; //-------------Delaring of Port number to 1 public int BaudRate = 9600; //---------Set BaudRate to 9600 public byte ByteSize = 8; //-----------Set ByteSize to 8 public byte Parity = 0; //-------------0-4 = no,odd,even,mark,space public byte StopBits = 0; //-----------0,1,2 = 1, 1.5, 2 public int ReadTimeout = 1500; //------Set TimeOut to 1500 private int hComm = -1; //-------------Declaring of comm port win32 file handle public bool Opened = false; //---------Declaring of Opened and set to false /*-- End of Definition of variables by Programmer --*/ [StructLayout(LayoutKind.Sequential)] public struct DCB { /*-- taken from c struct in platform sdk --*/ public int DCBlength; //-----------Sizeof(DCB) public int BaudRate; //------------Current baud rate public uint flags; //--------------Flags public ushort wReserved; //--------Not currently used public ushort XonLim; //-----------Transmit XON threshold public ushort XoffLim; //----------Transmit XOFF threshold public byte ByteSize; //-----------Number of bits/byte, 4-8 public byte Parity; //-------------0-4 = no,odd,even,mark,space public byte StopBits; //-----------0,1,2 = 1, 1.5, 2 public char XonChar; //------------Tx and Rx XON character public char XoffChar; //-----------Tx and Rx XOFF character public char ErrorChar; //----------Error replacement character public char EofChar; //------------End o

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups