Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Creating handle for COM Port

Status
Not open for further replies.

KH

Junior Member level 1
Junior Member level 1
Joined
Nov 1, 2004
Messages
15
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,281
Activity points
103
Hi,

Recently I upgrade from VC 6 to VC2005, and ported one program over. This program basically open the COM Port and send some binary data through the port.

The program did not give any compilation error or warnings on VC2005, but it always return an invalid handle. Below is part of the codes


char ComPort[5]="COM1";

ComHandle = ::CreateFile( LPCTSTR(ComPort), GENERIC_WRITE|GENERIC_READ,
0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL , NULL
);


These codes is working fine in VC6, but not VC2005, which part is wrong ?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top