Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mscomm32.ocx beyond port limit

Status
Not open for further replies.

newtofoxpro

Programmer
Sep 16, 2007
301
IN
Using Xp, VFP9.

As I learn it's limit is 16. I have found some info to alter mscomm32.ocx unofficially. And provide information does not worked for me.

Please help
 
To add: I'd say, the commands you have inside the IF may be working as is, if you execute them one by one in the command window, but that works because of the wait time inbetween.

Create a class based on olecontrol and choose the mscomm control, then you can put code inside it's OnComm event.

You may also define a seperate eventhandler class as illustrated here:
Bye, Olaf.
 
My opinion is that you're expecting some actions to happen without taking the hardware and the third party controls into consideration.
You need to approach this from the perspective that you're talking to a separate piece of equipment through a non-VFP control. It's not going to be as straight forward as simply doing a read on a file. You need to put all that communication in something like a do while loop, send some data, maybe even force a DO EVENTS to get the interface to respond, wait for the buffer to fill up, read it, and process the data.

The way I've gone about all that is to put the comm control on a form and respond to the OnComm event.
As an example:
Code:
&&... OnComm
IF (THIS.commEvent == 2) &&.AND. (THIS.InBufferCount > 0)
   DO WHILE THIS.InBufferCount > 0
      cInString = THIS.INPUT
      DOEVENTS
      x = INKEY(.1, 'HM')
   ENDWHILE
ENDIF


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Thank you.

mTimeOut=SECONDS()
DO WHILE mTimeOut+10>SECONDS()
IF ocomm.CommEvent==2
DO WHILE mTimeOut+10>SECONDS()
IF ocomm.InBufferCount>0
cInString=ocomm.Input && Problem at this line "Error reading com device"
DOEVENTS
=INKEY(0.1,"HM")
ENDIF
ENDDO
ENDIF
ENDDO
----------------------------
Similar modem found but could not understand vb.net

 
Does that change solve your problem now?

Because you left the comment && Problem at this line "Error reading com device"

If you still have the problem, the Input property might be protected, read only and only available from methods of the ocomm class/object itself. Adressing it with oComm.Input you access the object property from outside, which isn't possible for protected properties. The OnComm Event then would still be a better solution.

Bye, Olaf.
 
Does that change solve your problem now?

No

Sorry, I could not understand "The OnComm Event then would still be a better solution."



 
Repeating what I wrote earlier:

Actually there is an event to use, to read the input buffer: OnComm, described

Create a class based on olecontrol and choose the mscomm control, then you can put code inside it's OnComm event.
You may also define a seperate eventhandler class as illustrated here:
OnComm is the event handling incoming data, input...

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top