Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to close an application automatically when a 'CR' is closed

Status
Not open for further replies.

jbrowne

Programmer
Feb 1, 2000
182
IE
Hi,<br>I am calling a VB application from a Java program. The VB application's sole purpose is to run a Crystal Report with the parameters passed in from the Java program. It runs fine until I close the report print preview window. At this stage I want the VB application to end but I can't find a way of shutting it down automatically, thus I am left with a VB application running in the background on my PC. Can anyone tell me how to end my VB app. as soon as the user closes the report preview window. <br>Thanks in advance<br>John B.
 
Does the crystal report control generate an event when the print preview window is closed, if so, just end the vb program when that event is fired.<br> <p>nick bulka<br><a href=mailto:nick@bulka.com>nick@bulka.com</a><br><a href= > </a><br>
 
Thanks for the reply Nick. It was a good idea but unfortunately the closing of the preview window does not generate an event in the code. The actual code is &quot;CrystalReport1.Action = 1&quot; This is actually a print command, but you can stop it printing directly and go to a preview window instead by setting a property on the CR control. So you see the code has actually executed the command and regardless of what action you take with the preview window afterwards - it does not generate any further event. Messy isn't it !!
 
I don't know how comfortable you are using the Windows API, but you can use FindWindow to see if the Crystal Window exists, and if not, exit from your program.&nbsp;&nbsp;You'll need to supply the class name and/or window title. <p>nick bulka<br><a href=mailto:nick@bulka.com>nick@bulka.com</a><br><a href= > </a><br>
 
Private WithEvents mobjCrpeWindow As CRPEAuto.Window&nbsp;&nbsp;&nbsp;&nbsp;<br>'Allows you to monitor the close of Preview Window<br><br>Private Sub mobjCrpeWindow_ClosePrintWindow(useDefault As Boolean)<br>&nbsp;<br>&nbsp;' MsgBox
 
Hi, <br>Thanks for this but could you explain it a bit more detail for me please<br><br>John B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top