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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 'unresponsive' for 60 secs when closing MSCOMMLib.MSComm

David Higgs

Programmer
May 6, 2012
403
GB
My VFP application connects to my Amateur Radio Transceiver (via Serial COM Port 3) for CAT Control. CAT Control is a generic term used to describe how a PC can control the frequency and various other settings of a transceiver. The CAT commands are bi-directional. My application has run for a number of years without any ‘comms’ issues.

I’ve been looking at sharing the Transceiver (Serial COM Port 3) with VFP and another 3rd Party Application. I decided on using a Virtual Serial Port Emulator (VSPE) by https://eterlogic.com/products.vspe.html

I configured VSPE to allow my VFP application using Virtual Serial Port COM 10 to communicate with my Transceiver Serial Port COM 3. I intend using another 3rd Party Application on Virtual Serial Port COM 11.

When running VSPE, my VFP application (Virtual Serial Port COM 10) connects to my Transceiver (COM 3) and works as expected. However, I have an issue which I’ve not be able to resolve. When I exit my VFP application by clicking the ‘Exit Program’ Command Button VFP becomes ‘unresponsive’ for 60 secs before closing down.

VSPE Test

To eliminate any ‘code’ issues with my VFP application, I created a simple VFP Form with just three Command Buttons ‘Set Frequency 1’, ‘Set Frequency 2’ and ‘Exit Program’

I ran this VFP Form with no other Code, it opened and closed with no issues.

I then added an ‘ActiveX Control OLE Class MSCOMMLib.MSComm.1’ to the form.

I then ran the VFP Form again and when clicking the ‘Exit Program’ Command Button the application became ‘unresponsive’ for 60 Seconds and then closed.

The only time the problem (VFP being un-responsive for 60 Secs) seems to manifest itself is when I run VFP and VSPE together.

My VFP application works ok when connected directly to my Transceiver on Serial Port COM 3.

VSPE works ok with my Transceiver using other 3rd party applications.

Comms settings

Screenshot 2025-02-20 125149.png
Screenshot 2025-02-20 125249.png

Code:
* Command Button 1

thisform.transceiver.output = "FA003760000;"     && Set Transceiver Frequency 

* Command Button 2

thisform.transceiver.output = "FA007160000;"     && Set Transceiver Frequency 

* Command Button 'Exit Program'

thisform.transceiver.PortOpen = .F.    && Release Comm Port

thisform.Release
 
I created a TEST.PRG with the following code:

Code:
_SCREEN.AddObject("oComm","olecontrol","MSCommLib.MSComm.1")

An error message says: Object Class is Invalid for this container.
 
Oh wow, _screen is a form just like, but I should have tried this before suggesting, sorry . Well, you could still put the MSCommLib.MSComm.1 control into any other form and start it once, never show that form it but use its MSCommLib.MSComm.1 control.

Perhaps use this simple class definition for it:
Code:
oCOMM = CreateObject("COMMform")
* COMM object now available as oCOMM.COMM.
Define Class COMMform as Form
   Add Object comm as Olecontrol With Oleclass="MSCommLib.MSComm.1"
Enddefine

I know that the winsock control license VFP has only allows Winsock to be used on forms, I did not think that's also a limitation of the MSCommLib.MSComm.1 control. Even when it's the same, _screen is a form.
 
Last edited:

Part and Inventory Search

Sponsor

Back
Top