CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2000
    Location
    The Netherlands, Overijssel
    Posts
    733

    How can i use the Serial port in vc++?

    How can i use the serial port in vc++ (sending bits etc). ?
    Thanks!

    Clemens Timmermans (17-Year old)
    Webmaster of: http://www.maxcode.com/
    This Website Contains: sourcecodes for all major programming languages with special C/C++/VC++



    [url=http://www.maxcode.com/modules.php?name=Topics] Articles [url] | [url=http://www.maxcode.com/modules.php?name=Downloads&d_op=viewdownload&cid=4]
    Compilers [url] | [url=http://www.maxcode.com/modules.php?name=Downloads]Code Samples[url]

  2. #2
    Join Date
    Jun 1999
    Location
    San Diego, CA
    Posts
    600

    Re: How can i use the Serial port in vc++?

    Use CreateFile with "COM1", "com2", etc. Then just read/write using the file handle.

    Any one who knows he/she is not smart is smart.
    Any one who knows he/she is smart is not smart.
    You ask me if I am smart or not? Well...
    I don't know - you tell me :-)

  3. #3
    Join Date
    Jan 2000
    Location
    The Netherlands, Overijssel
    Posts
    733

    Re: How can i use the Serial port in vc++?

    but when i say serial i mean the lpt1 port

    Clemens Timmermans (17-Year old)
    Webmaster of: http://www.maxcode.com/
    This Website Contains: sourcecodes for all major programming languages with special C/C++/VC++



    [url=http://www.maxcode.com/modules.php?name=Topics] Articles [url] | [url=http://www.maxcode.com/modules.php?name=Downloads&d_op=viewdownload&cid=4]
    Compilers [url] | [url=http://www.maxcode.com/modules.php?name=Downloads]Code Samples[url]

  4. #4
    Join Date
    Nov 2000
    Posts
    31

    Re: How can i use the Serial port in vc++?

    Parallel port (LPT1 etc) works exactly the same way, just use "LPT1" instead of "COM1"

    good luck


  5. #5
    Join Date
    Jan 2000
    Location
    The Netherlands, Overijssel
    Posts
    733

    Re: How can i use the Serial port in vc++?

    hmmm.. i'll try
    thanks for the link both!!


    Clemens Timmermans (17-Year old)
    Webmaster of: http://www.maxcode.com/
    This Website Contains: sourcecodes for all major programming languages with special C/C++/VC++



    [url=http://www.maxcode.com/modules.php?name=Topics] Articles [url] | [url=http://www.maxcode.com/modules.php?name=Downloads&d_op=viewdownload&cid=4]
    Compilers [url] | [url=http://www.maxcode.com/modules.php?name=Downloads]Code Samples[url]

  6. #6
    Join Date
    Jun 2001
    Posts
    14

    Re: How can i use the Serial port in vc++?

    accessing serial port or lpt port in windows is same as accessing a file. u can use CreateFile function in it insteady of file name use com1 or com2 whatever. see msdn help for more. also go through DCB structure and COMMTIMEOUTS structure.


  7. #7
    Join Date
    Aug 1999
    Location
    Canada
    Posts
    2,076

    Re: How can i use the Serial port in vc++?

    Take a look here:

    http://msdn.microsoft.com/library/te...sdn_serial.htm

    For parallel port you can use the same method.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured