Click to See Complete Forum and Search --> : Accessing serial port with VC++


kapil
April 14th, 1999, 11:09 PM
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.

MikeL
April 15th, 1999, 05:40 AM
How are you opening the file?

kapil
April 15th, 1999, 11:13 PM
well i am just running my executable which accesses the serial port, by ReadFile and Writefile commands.

MikeL
April 16th, 1999, 02:57 AM
Are you using CreateFile and if so what params.

kapil
April 16th, 1999, 07:59 AM
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

MikeL
April 16th, 1999, 08:04 AM
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?