CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 1999
    Location
    Indore India
    Posts
    34

    Accessing serial port with VC++



    i made a software in VC++ (compiled it on win 95)
    it accesses the serial port(through standard "ReadFile & WriteFile" commands)
    and transmits data onto some hardware connected to the PC, through the serial port. when i tried to run the executable on win NT, it said that it can't access the port.
    i even tried to run the executable from the administrator's account, just to make sure that you don't need administrative priveliges to access the port.
    but it failed even there.
    how do i fix this problem?

    thanks in advance.


  2. #2
    Join Date
    Apr 1999
    Location
    Bruton, Somerset, England
    Posts
    47

    Re: Accessing serial port with VC++

    How are you opening the file?


  3. #3
    Join Date
    May 1999
    Location
    Indore India
    Posts
    34

    Re: Accessing serial port with VC++

    well i am just running my executable which accesses the serial port, by ReadFile and Writefile commands.


  4. #4
    Join Date
    Apr 1999
    Location
    Bruton, Somerset, England
    Posts
    47

    Re: Accessing serial port with VC++

    Are you using CreateFile and if so what params.


  5. #5
    Join Date
    May 1999
    Location
    Indore India
    Posts
    34

    Re: Accessing serial port with VC++

    no i am not using CreateFile or anything like that...
    i think i didn't explain clearly..
    in my program, i try accessing COM1, COM2, COM3, COM4 using
    init_com_port("com1", 9600) and so on.
    9600 here is the baud rate... whichever port i am able to access first, i set that as my port..
    but in case of win NT, my aplication(which i built on win 95) is unable to access the port any of these ports .
    i hope i made myself clear here.

    kapil


  6. #6
    Join Date
    Apr 1999
    Location
    Bruton, Somerset, England
    Posts
    47

    Re: Accessing serial port with VC++

    What is init_com_port()?
    If you're using ReadFile/WriteFile you must first open the file using something like CreateFile?
    Could this be your problem?


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