Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows
Visual Basic > API and Miscellaneous sample source codes
See if Crystal Reports is being viewed on screen or is done printing.
See if Crystal Reports is being viewed on screen or is done printing. 'This code will allow you to check if a Crystal report 'is still being viewed on the screen or if the report is 'done printing. 1. Put this code a module. Declare Function GetActiveWindow Lib "User32" () As Long Declare Function IsWindow Lib "User32" (ByVal hWnd As Long) As Long Dim Destination as Integer 2. Set the Destination var on a form 3. Start to print the report. frmNAME.report1.Destination = Destination frmNAME.report1.Action = 1 ' Start your eng ' This is the code that we all have been waiting for. '**** destination **** 0 = Screen **** 1 = Printer ***************************** Select Case Destination Case 0 'Dim hWndCrystalWindow As Integer hWndCrystalWindow = GetActiveWindow() While (IsWindow(hWndCrystalWindow)) DoEvents Wend ' The wait is over Case 1 'Dim status1 While status1 = 0 status1 = frmPrintInv!crwreport1.Status DoEvents Wend 'The wait is over End Select
Privacy Policy
|
Link to Us
|
Links