Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MSComm Control causing an external software program to crash while communicating with it.

Posted on 2004-11-03
7
Medium Priority
?
198 Views
Last Modified: 2013-12-26
I am using VB 6.0 programming a MSCOMM control running under WINNT OS.  I am Using this program to interface with a external program that develops and sends a file to a solder flow machine.  This machine has three main programs that we run.  I am using a touchscreen computer and writing the code to download the program to the solder machine and also upload the program from the external software program.  When running the following code I get this error msg and the external program shuts down, if i step through the program, it works fine.

Private mnuReceive_Click()
Dim A as integer
If TypePart = 1 then
MSComm3.output = NAME?
loop while MSComm3.InBufferCount = 0
temp = MSComm3.input
temp = Left(temp,4) ' gets the name of the program from the external software
A = 0
Data_DCND(A,0) = temp ' stores the data in an array
do while a< 100
call stepTXT(A)
MSComm3.output = Step
temp = ""
do
doevents
temp = temp & MSComm3.input
Loop until InStr(temp, vbcrlf)
Data_DCND(A + 1,0) = temp
A = A + 1
if temp = "0019000000000000000000000000000000000000" & VbCrLf then
ProgramReceived = 1
msgbox ("Program Received")
exit sub
end if

loop
end if
end sub

Private Sub StepTXT(A as integer)
if A <= 9 then
Step = "Step000" & A
elseif A > 9 and A < 100 then
Step = "Step00" & A
else
Step = "Step0" & A
end if
end sub

What could be causing my problem?
0
Comment
Question by:jfarmer20
  • 4
  • 2
6 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 12491173
The program at the other end is faulty if it crashes with unexpected data.
Your program is full of syntax errors. I'm surprised you can get it to run at all.

Private mnuReceive_Click()
should be
Private Sub mnuReceive_Click()

MSComm3.output = NAME?
quotes missing round string literal

loop while MSComm3.InBufferCount = 0
Missing Do
etc, etc
0
 

Author Comment

by:jfarmer20
ID: 12494866
Sorry about the typing errors.   I did not cut and paste the program, I retyped into the question.  There are not any syntax errors on the program.  What I have noticed is when the program is running, the external software receives multiple commands and does not see the VbCrLf.  (Example:  NAME?NAME?NAME?)
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 12495032
Ar you sending the vbCrLf?  I can't sse it in what you typed.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jfarmer20
ID: 12497166
I did not type in the VbCrLf on the original question, I am sending the VbCrLf along with the data.  I added a sleep function in the program between the writes and reads which helped.  The program will now run but sometimes it will not communicate with the external program.  Still maybe something about the protocol from the external software (Software is called SPA 250-400 which creates and downloads programs to a solder wave machine).  Thanks for the help you have been giving me.

0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 150 total points
ID: 12497777
Sorry, this is a VB-specific area. We do not know about particular applications. Do you have a link to the site which gives information about the protocol that they use?
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 12814544
I don't hink I was much help here. Please refund the questioner's points.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question