Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MSCOMM problem
Message
From
03/07/2009 14:42:35
 
 
To
03/07/2009 09:25:32
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01409887
Message ID:
01409966
Views:
60
>>Hi
>>
>>Our POS application writes to a Pole Display. The Pole display is usually a Logitech model.
>>If not Logitech, it will emulate a Logitech.
>>
>>I have had comments from a few of our installations that the system occasionally "hangs" at seemingly random times. With the help of the COVERAGE command, I found that when the "system hang" occurs, this line of code
>>
>>
>>     Thisform.oMSComm.PortOpen = .F.
>>
>>
>>takes over a minute to execute. Most of the time, the execite time for this line is approx .044 seconds.
>>
>>I was elated to isolate the gremlin, but I have no idea what to do about it.
>>
>>Below is the code that does the communications. This code works 99.4 percent of the time.
>>
>>
>>
>>
>>********************************************************************************
>>* Method:    D_POSNEW.OUTPUTLINEDISPLAY
>>* Date:      11/05/06
>>* Author:    Ken Buch 
>>* Notice:     Copyright (c) 2006 ** KBA Software **, All Rights Reserved.
>>* Compiler:  Visual FoxPro 09.00.0000.3504 for Windows for Windows
>>* Comments:  
>>* 			  
>>* Change Log:
>>* 			  
>>***************************************************************************
>>LPARAMETERS tcLine1,tcLine2
>>
>>LOCAL lcText,lcReset,lcNormalMode
>>
>>IF EMPTY(tcLine1)
>>	tcLine1 = ''
>>ENDIF
>>IF EMPTY(tcLine2)
>>	tcLine2 = ''
>>ENDIF
>>
>>*format lines to 19 characters plus CR/LF plus 19 characters
>>lcText = LEFT(tcLine1,19) + CHR(13) + CHR(10) + LEFT(tcLine2,19)
>>
>>THISFORM.poledisplay = lcText
>>THISFORM.pgf1.pageInSale.edtPoleDisplay.Refresh()
>>THISFORM.pgf1.pageTender.edtPoleDisplay.Refresh()
>>
>>IF TYPE('thisform.oMSComm.Name')#'C'
>>	TRY
>>		Thisform.oMSComm=CREATEOBJECT('mscommlib.mscomm.1')
>>		Thisform.oMSComm.Settings='9600,N,8,1'
>>		Thisform.oMSComm.CommPort = oAPP.poledisplaycommport
>>	CATCH
>>		IF oAPP.poledisplay
>>	                          WAIT WINDOW NOWAIT 'Microsoft Communications Control not installed'
>>		ENDIF	
>>	ENDTRY
>>ENDIF
>>
>>TRY
>>	lcReset = CHR(31)
>>	lcNormalMode = CHR(17)
>>	IF NOT Thisform.oMSComm.PortOpen
>>	     Thisform.oMSComm.PortOpen = .T.
>>	ENDIF
>>
>>	Thisform.oMSComm.Output = lcReset + lcNormalMode + lcText
>>	Thisform.oMSComm.PortOpen = .F.
>>CATCH
>>	IF oAPP.poledisplay
>>	     WAIT WINDOW NOWAIT 'Microsoft Communications Control not installed'
>>	ENDIF	
>>ENDTRY	
>>
>>
>
>Ken
>
>Easiest way is to try like this
>
>Thisform.oMSComm.Output = lcReset + lcNormalMode + lcText
>IF Thisform.oMSComm.PortOpen
>    Thisform.oMSComm.PortOpen = .F.
>ENDIF
>
Thanks,

I think I will just leave the port open and see what happens.

Ken
Previous
Reply
Map
View

Click here to load this message in the networking platform