求教 —— 关于多串口编程的问题 我写了一个程序使用RS-232口与其它设备通信,PC串口不够用,装上了一个MOXA的 8串口卡,这样PC上的串口就有10个:COM1-COM10。用原来的代码可以和COM1-COM9通信。但是不能和COM10通信不知哪位大侠可以帮忙。 hCom = CreateFile( "COM10", GENERIC_READ | GENERIC_WRITE, 0, // exclusive access NULL, // no security attributes OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL ); hCom=0xffffffff; GetLastError()的结果是2,(FILE NOT FOUND)。 the port "COM1" is avalible in the list box of windows hyperterm.exe,and we can use 2 hypertem.exe,1st hyperterm uses COM1,the 2nd hypertem uses COM10,both 2 hyperterm can communicate with each other.and we can get files transfered uses the protocol "Zmodem with Crash recovery". In the ms-dos prompt,type "mode|more" and press the "enter" key, we can get a list of devices,lpt1,con,and COMs,including the port COM10. Open the notpad.exe and type some words,save it as the file name "COM1" or "COM9",there we get a message box prompts that the file "COM1"or"COM9", consequently,is already exits,and asks if we really wanna replace this file.But if we uses "COM10" as the file name,the notepad simply create a file with named as "COM10" in the current directory. open regedit.exe,and open the key"\HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOM" we can see a list of ports on the MOXA card and motherbord. In Microsoft Windows 2000 Server,we can change the names of the ports by editing the value of some keys,ie.,if we wanna change COM5 to COM13,we simply edit this key.After that,"COM13" will apear in the list of hypertem,and we can use this port to transfer files also. But this doesn't work in Windows 2000 professional. What should I do? can you help me?
我写了一个程序使用RS-232口与其它设备通信,PC串口不够用,装上了一个MOXA的
8串口卡,这样PC上的串口就有10个:COM1-COM10。用原来的代码可以和COM1-COM9通信。但是不能和COM10通信不知哪位大侠可以帮忙。
hCom = CreateFile( "COM10",
GENERIC_READ | GENERIC_WRITE,
0, // exclusive access
NULL, // no security attributes
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL
);
hCom=0xffffffff;
GetLastError()的结果是2,(FILE NOT FOUND)。 the port "COM1" is avalible in the list box of windows hyperterm.exe,and we can use 2 hypertem.exe,1st hyperterm
uses COM1,the 2nd hypertem uses COM10,both 2 hyperterm can communicate with each other.and we can get files transfered
uses the protocol "Zmodem with Crash recovery".
In the ms-dos prompt,type "mode|more" and press the "enter" key,
we can get a list of devices,lpt1,con,and COMs,including the
port COM10.
Open the notpad.exe and type some words,save it as the file
name "COM1" or "COM9",there we get a message box prompts that
the file "COM1"or"COM9", consequently,is already exits,and asks if we really wanna replace this file.But if we uses "COM10" as the file
name,the notepad simply create a file with named as "COM10" in
the current directory.
open regedit.exe,and open
the key"\HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOM"
we can see a list of ports on the MOXA card and motherbord.
In Microsoft Windows 2000 Server,we can change the names of the
ports by editing the value of some keys,ie.,if we wanna change COM5
to COM13,we simply edit this key.After that,"COM13" will apear in
the list of hypertem,and we can use this port to transfer files also.
But this doesn't work in Windows 2000 professional.
What should I do? can you help me?
GENERIC_READ | GENERIC_WRITE,
0, // exclusive access
NULL, // no security attributes
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL
);