none
Word in eigene WinForm einbetten RRS feed

  • Frage

  • Hallo,
     
    gibt es eine Möglichkeit Word in einer WinForm Anwendung einzubetten ?
     
    Im Anhang habe ich von einer Demoanwendung ein Bild gelegt. Die können in
    ihrer App Worddokumente bearbeiten.
     
    Hat jemand eine Idee wie man da vorgeht ?
     
    Danke Andreas
    Donnerstag, 20. Oktober 2011 13:48

Antworten

  • Hallo Andreas Waning,
    Schau Dir mal folgenden Diskussionsfaden an .Vielleicht kann er Dir weiterhelfen.
    Externes Programm in Form Integrieren --> http://social.msdn.microsoft.com/Forums/de-DE/visualbasicde/thread/35eb1512-92ea-4d38-bf1e-5c698a3bf31d
    In C# wäre das z.B.
    *****************************************************************
            [DllImport("user32", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
            public static extern IntPtr SetParent(IntPtr HWNDChild, IntPtr HWNDNewParent);

            [DllImport("user32.dll")]
            static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

            [DllImport("user32.dll")]
            [return: MarshalAs(UnmanagedType.Bool)]
            private static extern bool IsWindowVisible(IntPtr hWnd);

            private const int WM_SYSCOMMAND = 274;
            private const int SC_MAXIMIZE = 61488;

            private void button1_Click(object sender, EventArgs e)
            {
                Process proc = Process.Start(@"C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE");
                //proc.WaitForInputIdle();
                Thread.Sleep(500);
                SetParent(proc.MainWindowHandle, this.panel1.Handle);
                SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0);

            }

    *****************************************************************
    Grüße,
    Robert

    Donnerstag, 20. Oktober 2011 15:15
    Moderator

Alle Antworten

  • Hallo Andreas Waning,
    Schau Dir mal folgenden Diskussionsfaden an .Vielleicht kann er Dir weiterhelfen.
    Externes Programm in Form Integrieren --> http://social.msdn.microsoft.com/Forums/de-DE/visualbasicde/thread/35eb1512-92ea-4d38-bf1e-5c698a3bf31d
    In C# wäre das z.B.
    *****************************************************************
            [DllImport("user32", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
            public static extern IntPtr SetParent(IntPtr HWNDChild, IntPtr HWNDNewParent);

            [DllImport("user32.dll")]
            static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

            [DllImport("user32.dll")]
            [return: MarshalAs(UnmanagedType.Bool)]
            private static extern bool IsWindowVisible(IntPtr hWnd);

            private const int WM_SYSCOMMAND = 274;
            private const int SC_MAXIMIZE = 61488;

            private void button1_Click(object sender, EventArgs e)
            {
                Process proc = Process.Start(@"C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE");
                //proc.WaitForInputIdle();
                Thread.Sleep(500);
                SetParent(proc.MainWindowHandle, this.panel1.Handle);
                SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0);

            }

    *****************************************************************
    Grüße,
    Robert

    Donnerstag, 20. Oktober 2011 15:15
    Moderator
  • Hallo Andreas Waning,

    Ich gehe davon aus, dass die Antwort Dir weitergeholfen hat.
    Solltest Du noch "Rückfragen" dazu haben, so gib uns bitte Bescheid.

    Grüße,
    Robert

    Dienstag, 1. November 2011 12:04
    Moderator