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 795729
In Process

The Archive Base Latest Questions

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

I am displaying a new Form from one process by passing the Show method

  • 0

I am displaying a new Form from one process by passing the Show method the handle of a Form created in another process. I only want this new Form to display above the passed Form, like a MessageBox.

However, this newly launched Form appears above other application windows, despite:

  • Setting Process.WindowStyle.Hidden to the Form-displaying process
  • Overriding the ShowWithoutActivation and CreateParams properties of the Form.
  • Making sure Form.TopMost is not true

I have checked that the window handle is valid from the second process.
Focus is not stolen, however.

Process A:
Pass (Form) window handle to a new Process B via the command line

Process B:
Display a new Form using Form.Show(anotherProcessWindowHandle)
  • 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-14T22:31:32+00:00Added an answer on May 14, 2026 at 10:31 pm

    You are battling the rulez of SetForegroundWindow(). Note the long list of “it won’t work” in the Remarks section. AllowSetForegroundWindow() is the solution.


    To ensure that a window always overlaps another window, display it with the Show() or ShowDialog() override that takes the owner argument. For example:

     using (var dlg = new MyMessageBoxForm(ex.Message)) {
         dlg.ShowDialog(this);
     }
    

    An owned window is always shown on the top of its owner and gets minimized and closed along with its owner.


    Making the window of another process the owner of your window is expressly forbidden by the Windows SDK. Windows Forms won’t let you do this. There is however an appcompat mode for Windows version 3 apps. Back then, there was no problem doing this, it didn’t support threading. P/Invoke SetParent() on your window and pass the window handle of the window from the other process. It breaks the warranty, but tends to work well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one form: FormPrincipal.cs In this form there is a public method called
I'm very new to PHP and I have a small task of displaying a
I have string like : '<New guest with special chars>' Its displaying nice with
When displaying all articles of a specific month (given through the urls like this
I'm displaying records in a grid format from an ActiveRecord list using each_slice. What
I am creating a form, and on load it gets all images from my
I have a form, in that I have user control(for displaying member name with
I have a very simple page that is displaying canned data. I experienced this
I'm new to C#. And I would like to program something like, displaying the
Having issue with displaying the Data from a second Activity. when I run the

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.