Print dialog close event handler

Dear Bentley Community,

I have a macro which does some things and then opens the print dialog box.  When the user clicks on the print dialog box and closes the window, I would like to display a messagebox.  Can anyone provide code to caputre this window close event or prevent my code from continuing while the window is open?

Thanks in advance,

Christmas May

Parents Reply
  • Unknown said:
    What are the options for the first variable statisticsP?

    The function mdlSystem_getTaskStatistics is documented in the MDL Help manual. However, for your purpose the variable is not used and is set to zero. The code in the link I cited shows how to use that function in VBA.

    Unknown said:
    Do you have a list of functions available in stdmdlbltin.dll?

    If you browse the MDL Help manual you will find several thousand functions. Some are implemented in stdmdlbltin.dll, others in one of the many DLLs delivered with MicroStation.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Children
  • Where would I acquire a copy of the MDL Help manual?

  • Here is the code I have so far, and to the best of my knowledge it works as desired.  If you have any comments/suggestions, then please feel free. . .

    Option Explicit

    Declare Function mdlSystem_getTaskStatistics Lib "stdmdlbltin.dll" (ByVal statisticsP As Long, ByVal taskIdP As String) As Long

    Private Sub cPause(cSeconds As Single)

        Dim cStartTime As Single
        Dim cFinishTime As Single
           
        'Get the current number of seconds since the beginning of the day
        cStartTime = Timer
        cFinishTime = cStartTime + cSeconds
       
        'Adjust for midnight
        If cFinishTime > 86400 Then cFinishTime = cFinishTime - 86400
           
        Do Until Timer > cFinishTime
              DoEvents
        Loop
       
    End Sub

    Sub Main()
       Dim cPlotDialog As Boolean
      
       'Before
       MsgBox "Before"
      
       'During
       CadInputQueue.SendCommand "DIALOG PLOT"
       MsgBox "During"
      
       'After
       cPlotDialog = True
       Do While cPlotDialog = True
          If mdlSystem_getTaskStatistics(0, "PLOTDLG") = 0 Then
             cPlotDialog = True
          Else
             cPlotDialog = False
          End If
         
          'Pause 0.1 seconds for user interface with Microstation (i.e. close the Plot Dialog box)
          cPause (0.1)
       Loop
       MsgBox "After"
    End Sub

     

  • You suggested monitoring two things.  The first of which was monitoring if the PLOTDLG was loaded.  Because a link to example code was provided, I used this method.  However, I'm uncertain what you meant by monitoring if the the print dialog is open?  What's the difference?

    NEVERMIND.  I now see there is a Microstation configuration variable MS_PLTDLG_UNLOADONCLOSE which somewhat ties the "close" operation to the "unload" operation.  As you might have guessed mine was set so that closing the dialog unloaded the application.  Why would you want the application to remain loaded? . . . I speculate it might improve system response time?

    Sincerely,

    Christmas May

  • PLOTDLG

    Unknown said:
    Why would you want the application to remain loaded?

    PLOTDLG.MA is MicroStation's printing application. The print dialog is the visible manifestation of that application.

    If you browse the PLOTDLG keyins, you will find that printing can be controlled entirely through a set of commands. In other words, you might want PLOTDLG.MA with no visible interface if you (or a VBA or MDL or .NET application) want to create prints by sending a sequence of commands.

    Plot Composer

    Plot Composer

    Plot Composer is an example of such an application.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Where would I acquire a copy of the MDL Help manual?

  • Unknown said:

    Where would I acquire a copy of the MDL Help manual?

    The MicroStation SDK is likely what you are looking for. The SDK for MicroStation V8 XM Edition (as well as for MicroStation V8i) can be downloaded from SELECTservices Online -- the SDK is a parallel download to the MicroStation product installation set. There is a recent version of the SDK available from www.bentley.com/developer and then following the "Software Developer Resources" link.