Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Running .exe in windows form but it opens an external window

Running .exe in windows form but it opens an external window

Scheduled Pinned Locked Moved C#
questioncsharp
12 Posts 6 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Sachin k Rajput

    I'm trying to open openoffice/Libreoffice impress(simpress.exe) in my C# windows form. But it opens in its own window and there is no data on form. I want to integrate it in my form. This is my code:

    ProcessStartInfo proc = new ProcessStartInfo();
    proc.FileName = @"C:\Program Files\LibreOffice 4.0\program\simpress.exe";
    proc.UseShellExecute = true;
    var process = Process.Start(proc);
    Thread.Sleep(2000);
    SetParent(process.MainWindowHandle, this.Handle);

    It open Libreoffice impress but not in my form. How can I integrate it with my form? Thanks!

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #3

    toms from newdelhi wrote:

    It open Libreoffice impress but not in my form.
    How can I integrate it with my form?

    Because LibreOffice is still loading and building it's form when you call SetParent. Try to WaitForInputIdle[^] before changing the parent.

    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

    S 1 Reply Last reply
    0
    • S Sachin k Rajput

      I'm trying to open openoffice/Libreoffice impress(simpress.exe) in my C# windows form. But it opens in its own window and there is no data on form. I want to integrate it in my form. This is my code:

      ProcessStartInfo proc = new ProcessStartInfo();
      proc.FileName = @"C:\Program Files\LibreOffice 4.0\program\simpress.exe";
      proc.UseShellExecute = true;
      var process = Process.Start(proc);
      Thread.Sleep(2000);
      SetParent(process.MainWindowHandle, this.Handle);

      It open Libreoffice impress but not in my form. How can I integrate it with my form? Thanks!

      H Offline
      H Offline
      Hari Om Prakash Sharma
      wrote on last edited by
      #4

      I have no idea how you can integrate it with your forms. You cannot use Process.Start to integrate any form with you custom form. Try to find any Library control like OCX control so that they can be integrated with your forms. But try this one [^]. I hope this will help you.

      First and the Foremost: FIGHT TO WIN

      P 1 Reply Last reply
      0
      • H Hari Om Prakash Sharma

        I have no idea how you can integrate it with your forms. You cannot use Process.Start to integrate any form with you custom form. Try to find any Library control like OCX control so that they can be integrated with your forms. But try this one [^]. I hope this will help you.

        First and the Foremost: FIGHT TO WIN

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #5

        Actually, you can. It takes a fair bit of interop work, but it is possible. Basically, you reparent the application into yours.

        I was brought up to respect my elders. I don't respect many people nowadays.
        CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

        D 1 Reply Last reply
        0
        • P Pete OHanlon

          Actually, you can. It takes a fair bit of interop work, but it is possible. Basically, you reparent the application into yours.

          I was brought up to respect my elders. I don't respect many people nowadays.
          CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

          D Offline
          D Offline
          dusty_dex
          wrote on last edited by
          #6

          I thought that COM automation is used for these jobs. OpenOffice would/should have registered a COM automation object for external applications to call the automation server (dll). www.oooforum.org/forum/viewtopic.phtml?t=9815

          "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

          P 1 Reply Last reply
          0
          • D dusty_dex

            I thought that COM automation is used for these jobs. OpenOffice would/should have registered a COM automation object for external applications to call the automation server (dll). www.oooforum.org/forum/viewtopic.phtml?t=9815

            "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #7

            You could do it this way, but you can also reparent other application windows.

            I was brought up to respect my elders. I don't respect many people nowadays.
            CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

            D S 2 Replies Last reply
            0
            • P Pete OHanlon

              You could do it this way, but you can also reparent other application windows.

              I was brought up to respect my elders. I don't respect many people nowadays.
              CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

              D Offline
              D Offline
              dusty_dex
              wrote on last edited by
              #8

              OK, this is new to me. I'll go and take a look. :)

              "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

              1 Reply Last reply
              0
              • P Pete OHanlon

                You could do it this way, but you can also reparent other application windows.

                I was brought up to respect my elders. I don't respect many people nowadays.
                CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

                S Offline
                S Offline
                Sachin k Rajput
                wrote on last edited by
                #9

                Actually I'm trying to integrate OpenOffice/LibreOffice in my C# windows form program. But I'm getting bootstrap error. So I thought to do it in this way. Is it not possible to integrate it in C# program. Do anyone having any idea of doing it? Please suggest.

                D 1 Reply Last reply
                0
                • L Lost User

                  toms from newdelhi wrote:

                  It open Libreoffice impress but not in my form.
                  How can I integrate it with my form?

                  Because LibreOffice is still loading and building it's form when you call SetParent. Try to WaitForInputIdle[^] before changing the parent.

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                  S Offline
                  S Offline
                  Sachin k Rajput
                  wrote on last edited by
                  #10

                  I used it but its not working. I used process.WaitForInputIdle() but getting the same result. Thanks!

                  1 Reply Last reply
                  0
                  • S Sachin k Rajput

                    Actually I'm trying to integrate OpenOffice/LibreOffice in my C# windows form program. But I'm getting bootstrap error. So I thought to do it in this way. Is it not possible to integrate it in C# program. Do anyone having any idea of doing it? Please suggest.

                    D Offline
                    D Offline
                    dusty_dex
                    wrote on last edited by
                    #11

                    This seems to fit your problem even though it's MSOffice in the examples. officeautomationcsharp.php & this fits in too. Hosting-EXE-Applications-in-a-WinForm :)

                    "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

                    1 Reply Last reply
                    0
                    • S Sachin k Rajput

                      I'm trying to open openoffice/Libreoffice impress(simpress.exe) in my C# windows form. But it opens in its own window and there is no data on form. I want to integrate it in my form. This is my code:

                      ProcessStartInfo proc = new ProcessStartInfo();
                      proc.FileName = @"C:\Program Files\LibreOffice 4.0\program\simpress.exe";
                      proc.UseShellExecute = true;
                      var process = Process.Start(proc);
                      Thread.Sleep(2000);
                      SetParent(process.MainWindowHandle, this.Handle);

                      It open Libreoffice impress but not in my form. How can I integrate it with my form? Thanks!

                      V Offline
                      V Offline
                      Vasudevan Deepak Kumar
                      wrote on last edited by
                      #12

                      Check out referring Embedded Open Office assembly.

                      Vasudevan Deepak Kumar Personal Homepage
                      Tech Gossips
                      The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep!

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups