Microsoft KB Archive/198128

= PRB: Accessing WINMODEM with MSComm Control Can Hang Application =

Article ID: 198128

Article Last Modified on 6/28/2004

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q198128



SYMPTOMS
While performing serial communications using the MSCOMM32.OCX with a WINMODEM, upon opening the com port, system resources will be reduced causing the application to hang.



CAUSE
WINMODEM is a software modem. It is different from a standard modem in that it does not include a UART (Universal Asynchronous Receiver Transmitter) chip or a processor chip to process instructions. Instead, it uses the computer's CPU. Necessary software and drivers must be loaded for the WINMODEM to work.



RESOLUTION
Do not open the port until you are ready to output characters to the modem. Immediately following the message MSComm1.PortOpen = TRUE, send a command string or other output to the modem. This can be as simple as an "AT" command string.



Steps to Work Around Behavior
 Create a new Standard EXE project. Form1 is created by default. Choose Components from the Project menu, check the "Microsoft Comm Control," and click OK. Add an MSComm control to the form.  Add the following code to Form1's code window: Private Sub Form_Load

With MSComm1 .Handshaking = 2 - comRTS .RThreshold = 1 .RTSEnable = True .Settings = "9600,n,8,1" .SThreshold = 1 ' Leave all other settings as default values. End With ' These next 2 lines avoid the problem MSComm1.PortOpen = True MSComm1.Output = "AT" End Sub

 Run the program. Without the MSComm1.Output line, the application will consume resources and may hang. With this line, the application runs fine, as expected.</ol>

<div class="references_section">