Launching an application from my Add-In (sometimes Word)

Hi;

I need to launch an application from within my Add-In (it's a Word Add-In).

1a. When I launch Word, I get the MessageBox "You cannot close Microsoft Office Word because a dialog box is open.\nClick OK, switch to Word, and then close the dialog box."

1b. When I click OK, I then have two instances of Word, but the one I launched is under the one I launched from (want it over).

2. When I launch another app (like IE), it comes up under Word. I want it over Word.

How can I fix the above

thanks - dave




Answer this question

Launching an application from my Add-In (sometimes Word)

  • Snoo68

    This is a non-VSTO related issue. You can post your question, however, in the MSDN office.developer.com.add_ins newsgroup. Here is the link:

    http://msdn.microsoft.com/newsgroups/default.aspx dg=microsoft.public.office.developer.com.add_ins&lang=en&cr=US

    Thanks!

    Mike Hernandez
    Community Program Manager
    VSTO Team


  • Chris Aus

    Dave

    It'd be helpful if you could attach at least a psudo code sequence of the steps you're going through, as we're somewhat unclear on what exactly it is you;'re trying to accomplish (and how).

    Also, which version of Office are you using

    Is this a managed add-in

    Thanks


  • oprasad79

    Hi;

    This is a IDTExtensibility2 based Add-In written in C# (calls a large J# library too but that is not involved here). It runs under Word 2000, 2002, & 2003 (build for all 3 using the COM libs for each).

    This is the code from my Add-In. When they click on a Word menu item, it puts up a status dialog (the class below) to show it is creating a report, then launches the report. Note it launches the file to display, not the app.

    The relevant code (just copied the bare minimum):

    this.Activated += new System.EventHandler(this.Report_Activated); // class is a Form
    ...
    private void Report_Activated(object sender, System.EventArgs e) {
    ...
       BeginInvoke(new LaunchDelegate(LaunchReport));
    }

    [SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
    private void LaunchReport() {
    ...
          string filename = "temp.rtf";
    ...
          Process rtn = Process.Start(filename);
          if ((rtn != null) && rtn.HasExited)
           MessageBox.Show("Application did not launch. Error: " + rtn.ExitCode, "AutoTag Launcher");
    this.Close();
    }

    thanks - dave



  • Launching an application from my Add-In (sometimes Word)