Question

Im en utilisant un contrôle axAcroPDFLib pris à partir d'une installation d'Adobe Reader 9 pour visualiser et imprimer des documents PDF utilisateur dans mon C # application de formulaires de fenêtre. Tout fonctionne bien jusqu'à la fin appication ...

Il jette l'erreur suivante:

  

L'instruction à "0x0700609c"   mémoire à « 0x00000014 ». le   mémoire ne peut pas être lu

Ma méthode de FormClosing est assez simple et je pense est faux, mais je ne savais pas comment le faire de la bonne façon:

private void Form2_FormClosing(object sender, FormClosingEventArgs e)
    {
        if (axAcroPDF1 != null)
        {   
            axAcroPDF1.Dispose();

        }
    }

Merci d'avance pour toute idée

Était-ce utile?

La solution

Je viens de comprendre comment fermer l'application correctement:

    [System.Runtime.InteropServices.DllImport("ole32.dll")]
    static extern void CoFreeUnusedLibraries();

    private void Form2_FormClosing(object sender, FormClosingEventArgs e)
    {
        if (axAcroPDF1 != null)
        {                                
            axAcroPDF1.Dispose();                
            System.Windows.Forms.Application.DoEvents();
            CoFreeUnusedLibraries(); 
        }
    }

avec cela, aucune erreur est renvoyée: D

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top