Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Think you're an expert? Answer this!!!

Posted on 1998-10-19
7
Medium Priority
?
151 Views
Last Modified: 2010-08-05
Here's a hard question for all you experts.

I've got a vb program that calls a Perl script. The Perl script will then convert a group of SGML files to HTML files. If there are any errors during the conversion, the error messages will be put into a text file. The vb program will then check that text file and if it has error messages, those messages will appear in a textbox within the vb program.

The problem has to do with WHEN the vb program checks the text file. What happens is that the vb program calls the Perl script, the Perl script forks (creates) another process which does the actual conversion.

My vb program doesn't know this. As a result, it checks the text file before the conversion finishes, so any error messages during the current conversion will not be displayed inside the vb program.

Below is a part of the code I'm talking about:

   'run the process.pl perl script
   RetVal = Shell("perl.exe C:\temp\process.pl D:\folder, 1)
   
   'function that displays error messages into textbox
   ShowErrorMessages

...so does anyone know how to fix this? How do I make it so the vb program knows when the actual conversion is finished and doesn't print the error messages too soon. Thanks.
0
Comment
Question by:hobster
7 Comments
 

Expert Comment

by:DJLawlor
ID: 1440683
Right!  For 5 points?

Look, a Hard question worth 200 Points!!!!


0
 
LVL 2

Expert Comment

by:WDB
ID: 1440684
Don't hold your breath for 5 freaking points!!
0
 
LVL 2

Author Comment

by:hobster
ID: 1440685
Sorry, I ran out of points.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Accepted Solution

by:
TheAnswerMan earned 0 total points
ID: 1440686
why dont you just use an INI File that has a status.. then you can do somthing like this

Declare Function GetPrivateProfileString Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

Function gfn_GetINIString(ByVal as_Group As String, ByVal as_Item As String, ByVal as_Default As String, as_INIFilePath As String) As String
 Dim ls_Temp As String
 Dim li_ReturnCode As Integer
 Dim lengthOfTemp As Long
 ls_Temp = String$(2048, 32)
 lengthOfTemp = Len(ls_Temp)
 li_ReturnCode = GetPrivateProfileString(as_Group, as_Item, as_Default, ls_Temp, lengthOfTemp, as_INIFilePath)
 gfn_GetINIString = Mid$(ls_Temp, 1, li_ReturnCode) & ""
   
End Function


and have a timer.. that checks it something like this.
assuming timer interval of one second.
this will check the file for one minute. then call your procedure to continue.. if it takes longer than a minute.. then maybe an error occurred>  you


Private Sub Timer1_Timer()
if len(gfn_GetINIString("DBConnection", "EagleDBConn", "", App.Path & "\" & App.Title & ".ini")) > 0 then
  Timer1.Enabled = false
else
    TimerCount = TimerCount + 1
    if timerCount > 60 then
       if vbyes = msgbox("It is taking a long time do you want to wait?) then
          timerCount = 0   'count for another minute
       else
          Call DefectiveRoutine
       end if
    end if
end if
End Sub


0
 

Expert Comment

by:zuf
ID: 1440687
You can launch your application using the ShellProcess API call and poll the list of running processes to see if it's finished.....
0
 
LVL 2

Author Comment

by:hobster
ID: 1440688
Not exactly the answer I was looking for since the user has to wait in 60 secs interval. But I'll give you the points.
0
 
LVL 1

Expert Comment

by:vbyuval
ID: 4253182
nice to know things
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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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

877 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