Link to home
Start Free TrialLog in
Avatar of tdc808
tdc808

asked on

MSComm

I need information on MSComm for VC++ 6.0.
I can sucessfully write to a port, but cannot read from a port.  Anyone know where there is any documentation on this topic?
Thanks in advance.
tdc808
Avatar of Ess
Ess

Try this link for documentation.
http://www.yes-tele.com/mscomm.html 
Alos if you own VB6 professional there is documentation in the reference section of MSDN on ActiveX controls included with it.  Note that the documentation includes constants that you cannot use with C++.  You must find out the numerical values of the constants.  Use OLE/VIEW for this.
Avatar of DanRollins
MSDN provides documentation of rhtis control, but as with many such controls, it is written for users of Visual Basic.  Find it here:

   http://msdn.microsoft.com/library/en-us/comm98/html/vbobjComm.asp

And in C++, it is a bit of a pain to use because of the variant data types, and so forth.  Most C++ users prefer to use CreateFile(), ReadFile(), WriteFile() API fns, and the ever useful ClearCommError() -- to learn when there is any input available.

Here is a summary:
   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp

THough complete, it is overly complicated becasue it talks about CommEvents and Overlapped I/O -- which you don't really need when you are getting started.

-- Dan
Avatar of tdc808

ASKER

Thanks for the advice.
I have switch over to using CreateFile(), ReadFile(), WriteFile() API fns, and I can write to the ports fine, but I am still having problems reading from the ports.
Everytime I receive a character from the port it decimal(204).  
What I am trying to do is write from port one and receive on port two, so I have three threads (ie. the main thread, port_1_thread & port_2_thread) running to coordinate the timing.  
Any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tdc808

ASKER

Hi Dan,

Thanks again.  I am just about to accept your comments, but if you have a second I would appreciate it if you could provide me feedback on the follow quick topics...

I am still having problem initiating and writing too two serial ports.  They are running on seperate threads.  The first one initiated works fine, but the second connection seems 'confused' (appears to receive some sort of cross talk)
Any ideas?

Another quick question.....
Any ideas on how to easily comment code...i.e. is there a special tool that allows you to comment/uncomment code?

I'm nearly sure that it is possible to read and write on two COMM ports, where each port is being handled by a separate thread.  I have done it with two modems -- but I was actually using TAPI, which might have smoothed the way somehow.  I don't know if you are trying to handle events or if you are being careful to not get the comm handles confused, etc... so I can't be much help.

To make a comment,
1) insert  // at the start of a line
   or
2) put /* at the start and */ at the end of a multiple-line comment
   or
3) add a line like
     #ifdef NEVERDEF
at the beginning and
    #endif // ifdef NEVERDEF
at the end.

-- Dan
Avatar of tdc808

ASKER

Thanks for the additional information, Dan.

I apologize for the confusion....I was actually wondering if VC++ 6.0 had a menu option to comment/uncomment selected code.  Do you know of any such feature?

Thanks in advance.
tdc808
I can't be sure that there is no such feature, but I've never heard of it.  I know that VisualStudio.NET does that sort of thing (collasping functions in outline mode, etc.), but it would never occur to me to want my text editor to handle something like that when I could do it myself :-)

-- Dan