Skip navigation
Currently Being Moderated

Plugin WindowsForm not closing before Acrobat window closes

Apr 16, 2012 10:33 AM

Tags: #acrobat #c++ #windows_form

I have a plugin that I am building that opens a Windows Form, lets the user check some stuff/do some calculations and then send a block of text to the PDF.

The problem is that if the user does not close the Windows Form before closing the main acrobat window, the program will crash due to a access violation in reading a memory location.  The problem does not happen if the windows form is closed first and then the main acrobat window is closed.



1. user opens a document

2. User launches the window form using the plugin

3. User does some work using the document and the windows

4. User is done so they close the acrobat window

5. User sees that the windows form is open still and closes it.

6. Error happens



I create the windows form using Application::Run(gcnew Form1());

In the windows form, I added this function:


public: static void ExitCalc(){


This function is called in the .cpp file that generates the dropdown menu as part of the PluginUnload but the problem stays.

I need to close the windows form object before the acrobat window closes.


Thanks for the help.

  • Currently Being Moderated
    Apr 16, 2012 10:42 AM   in reply to Raynovac

    Why not register for a WillClose() event?

    Mark as:
  • Currently Being Moderated
    Apr 16, 2012 11:38 PM   in reply to Raynovac

    There is a notification that you can register for when a document is about to close (and lots of other ones too!).   Check the docs for information about notifications.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points