Compiled VB6 app won't run
Compiled VB6 app won't run
Compiled VB6 app won't run
Compiled VB6 app won't run
Compiled VB6 app won't run
Compiled VB6 app won't run Compiled VB6 app won't run Compiled VB6 app won't run Compiled VB6 app won't run Compiled VB6 app won't run Compiled VB6 app won't run Compiled VB6 app won't run Compiled VB6 app won't run
Compiled VB6 app won't run Compiled VB6 app won't run
Compiled VB6 app won't run
Go Back  Xtreme Visual Basic Talk > > > Compiled VB6 app won't run


Reply
 
Thread Tools Display Modes
  #1  
Old 04-08-2010, 09:21 AM
Lectricman Lectricman is offline
Newcomer
 
Join Date: Apr 2010
Posts: 2
Default Compiled VB6 app won't run


I have a VB6 app that reads data from the comm port, and it will run fine all day from within Visual Basic. But the compiled app will take anywhere from one to several readings from the comm port, and then the app just vaoprizes into thin air. It doesn't generate any error messages. The app just terminates and dissapears.

I have over a dozen VB6 apps that we use all the time, and many of them read data from the comm port, but I have never had this sort of problem.

This new problem app is much more spartan that any of the others. It takes readings from several Mitutoyo thickness gages connected to the comm port. I have other apps that do this too, but they only read one thickness gage, and they are connected to older Mitutoyo hardware.

Anyone have any ideas what might be wrong?

Here is my code from the MSComm1_OnComm event;

Private Sub MSComm1_OnComm()

buff$ = MSComm1.Input

If Len(buff$) > 0 Then
dat$() = Split(buff$, vbCrLf)
For f = 0 To UBound(dat$)
dat2$() = Split(dat$(f), ",")
RowDat(f, 1) = dat2$(0)
RowDat(f, 2) = dat2$(1)
Next f
Beep

Grid1.Rows = Grid1.Rows + 1
Grid1.Row = Grid1.Rows - 2
Grid1.Col = 0
Grid1.Text = Grid1.Rows - 2
For f = 1 To 9
Grid1.Col = f
Grid1.Text = RowDat(f - 1, 2)
Next f
If Grid1.Rows > 13 Then
Grid1.Width = 9940
Grid1.TopRow = Grid1.TopRow + 1
End If
End If
End Sub
Reply With Quote
  #2  
Old 05-21-2010, 02:36 PM
Cerian Knight's Avatar
Cerian KnightCompiled VB6 app won't run Cerian Knight is offline
Polymath (in disciplina)

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,191
Default

If you still need help on this (I've been out for a while), I see several problems. You are not checking why OnComm triggered (comEvReceive) and you seem to be presuming that all the data was received when OnComm is triggered, when in fact OnComm (on a fast computer with compiled code) will trigger once for each character received. You need to build a buffer using a Static or Public variable and each time a comEvReceive occurs, check to see if the buffer contains enough information to parse and act on. Only that data should then be removed from your buffer, leaving any partial responses in the buffer to be completed later.
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').
Reply With Quote
  #3  
Old 05-23-2010, 08:46 AM
Lectricman Lectricman is offline
Newcomer
 
Join Date: Apr 2010
Posts: 2
Default

Wow. Thanks for the response. That explains quite a bit. I didn't know anything about comEvReceive. That helps explain why I'm not receiving full strings from my RS232 devices like I did with QuickBasic many years ago. Since converting my old QB apps to VB, I've had to check for a vaild string within the string that I received, and reject the entrire string received and keep doing that until I received a string containing a valid string like I was looking for. The way my apps are working now, I receive variable length strings with multiple characters in them. In QB, I always received a full string containing only the data from a single "transmission" from the device(s).

I will take a look at comEvReceive and see what I come up with. I will post my results back here.

I did find one computer that the app I asked about will run on. Most of my troubles started when our company upgraded to Office 2003 a year or so ago. The computer the new app works on hasn't had Office 2003 installed on it...

Thanks so VERY much!!!

Quote:
Originally Posted by Cerian Knight View Post
If you still need help on this (I've been out for a while), I see several problems. You are not checking why OnComm triggered (comEvReceive) and you seem to be presuming that all the data was received when OnComm is triggered, when in fact OnComm (on a fast computer with compiled code) will trigger once for each character received. You need to build a buffer using a Static or Public variable and each time a comEvReceive occurs, check to see if the buffer contains enough information to parse and act on. Only that data should then be removed from your buffer, leaving any partial responses in the buffer to be completed later.
Reply With Quote
  #4  
Old 05-23-2010, 11:25 PM
Cerian Knight's Avatar
Cerian KnightCompiled VB6 app won't run Cerian Knight is offline
Polymath (in disciplina)

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,191
Default

I usually just let '.RThreshold = 1' so that when 1 or more characters are in the buffer the OnComm will trigger and I add the character(s) to the buffer. Then I scan the buffer for a known terminator to see if a complete data string is present.

However, if your received data is fixed length, you could let .RThreshold be equal to the the response string size... but you should still parse the string to see if the data is out of sync for some reason. After going through that hassle, I find it more robust to just use '.RThreshold = 1' and accept the fact that any number of characters can be received each firing of OnComm so that I focus on the buffer parser and truncation code.
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Compiled VB6 app won't run
Compiled VB6 app won't run
Compiled VB6 app won't run Compiled VB6 app won't run
Compiled VB6 app won't run
Compiled VB6 app won't run
Compiled VB6 app won't run Compiled VB6 app won't run Compiled VB6 app won't run Compiled VB6 app won't run Compiled VB6 app won't run Compiled VB6 app won't run Compiled VB6 app won't run
Compiled VB6 app won't run
Compiled VB6 app won't run
 
Compiled VB6 app won't run
Compiled VB6 app won't run
 
-->