Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 718517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:32:09+00:00 2026-05-14T05:32:09+00:00

I have a WPF application that will always run on windows 7, it opens

  • 0

I have a WPF application that will always run on windows 7, it opens and displays in full-screen mode

There is a button within WPF app that opens up Word

I would like the WPF application on opening up Word to send a command to the operating system so that it tiles both the WPF application and the Word application windows side by side, so that they each take up 50% of screen each. Is this possible? if yes would anyone know what the code may be? ( a bit like when you right click on windows 7 task bar and click Show Windows Side by Side)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:32:09+00:00Added an answer on May 14, 2026 at 5:32 am

    Yes it is possible and is relatively easy.

    You say that you already have code that opens your WPF window “full screen”. Assuming this is a true “full screen” view and not a “maximized” window you have already calculated the screen rectangle. If not, you can use the Screen class from System.Windows.Forms to get the screen rectangle. Remember that the Screen class is part of WinForms, so it uses device coordinates (pixels) instead of resolution-independent coordinates (96dpi) so you’ll need to convert from Rectangle to Rect and then apply the PresentationSource.FromVisual(window).TransformFromDevice transform to get WPF coordinates.

    Once you have the screen Rect in device-independent (96dpi) coordinates, you must compute the separate rectangles. For example here is the computation for a 50% horizontal division of screenRect:

    Rect rect1 = new Rect(screenRect.X, screenRect.Y, screenRect.Width/2, screenRect.Height);
    Rect rect2 = new Rect(screenRect.X + screenRect.Width/2, screenRect.Y, screenRect.Width/2, screenRect.Height);
    

    Once you have the bounds you can adjust your own window simply enough:

    window.Left = rect1.X;
    window.Top = rect1.Y;
    window.Width = rect1.Width;
    window.Height = rect1.Height;
    

    Moving the Word window is slightly more complicated. You must convert to device coordinates, start the process, wait for Word to initialize, then call Win32’s SetWindowPos function. This must be done on a separate thread to avoid blocking the UI.

    // Transform rect2 to device coordinates
    rect2.Transform(PresentationSource.FromVisual(window).TransformToDevice);
    
    // Execute the rest of this in a separate thread
    ThreadPool.QueueUserWorkItem(_ =>
    {
      // Start Word
      var process = Process.Create(pathToWinwordExe);
    
      // Wait for Word to initialize
      process.WaitForInputIdle();
    
      // Set the position of the main window
      IntPtr hWnd = process.MainWindowHandle;
      if(hWnd!=IntPtr.Zero)
        SetWindowPos(
          hWnd, IntPtr.Zero,
          (int)rect2.X, (int)rect2.Y, (int)rect2.Width, (int)rect2.Height,
          SWP_NOZORDER);
    });
    

    Don’t forget the DllImport for SetWindowPos. Something like this should work:

    [DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true, ExactSpelling=true)]
    public static extern bool SetWindowPos(
      HandleRef hWnd, HandleRef hWndInsertAfter, int x, int y, int cx, int cy, int flags);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 499k
  • Answers 500k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is not pretty but it works: rm -R $(ls… May 16, 2026 at 12:45 pm
  • Editorial Team
    Editorial Team added an answer Yes. Override the base1 and base2 methods in Derived to… May 16, 2026 at 12:45 pm
  • Editorial Team
    Editorial Team added an answer No, you can't. Unfortunately, UIEvent doesn't expose any public way… May 16, 2026 at 12:45 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.