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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:18:31+00:00 2026-06-11T04:18:31+00:00

I want to show the windows form as a pop up window that appear

  • 0

I want to show the windows form as a pop up window that appear on the top of all the opened other application’s windows
i have used Focus method but it didn’t work.
so i have tried :

using System.Diagnostics;
using System.Runtime.InteropServices;

// Sets the window to be foreground
[DllImport("User32")]
private static extern int SetForegroundWindow(IntPtr hwnd);

// Activate or minimize a window
[DllImportAttribute("User32.DLL")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private const int SW_SHOW = 5;
private const int SW_MINIMIZE = 6;
private const int SW_RESTORE = 9;

private void ActivateApplication(string briefAppName)
{
    Process[] procList = Process.GetProcessesByName(briefAppName);

    if (procList.Length > 0)
    {
        ShowWindow(procList[0].MainWindowHandle, SW_RESTORE);
        SetForegroundWindow(procList[0].MainWindowHandle);
    }
}

as mentioned in a previous question on SO Here
but i couldn’t use it .
the right answer poster said “Basically, call ShowWindow() then SetForegroundWindow().” but i didn’t know what are the parameters for these methods

what exactly should i pass to the ShowWindow(); and the SetForegroundWindow(); methods??
any help?

  • 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-06-11T04:18:32+00:00Added an answer on June 11, 2026 at 4:18 am

    Here is my solution:

    private void ActivateApplication (string briefAppName) 
        {
            Process[] p=Process.GetProcessesByName (briefAppName);
            if (p.Length>0)
            {
                this.TopMost=true;
                ShowWindow (p[0].MainWindowHandle, 9);
                this.TopMost=false;
                this.Activate ();
            }
        }
    

    Use .Activate () to focus the form and TopMost to change Always-on-top state of the form.

    9 means Resotre window. If your window is already restored, ShowWindow function will do nothing. Look here for ShowWindow function’s documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548%28v=vs.85%29.aspx

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

Sidebar

Related Questions

I have a C# Windows application that I want to ensure will show up
I have a form in a Windows form application that I want to display
I have a simple Windows Form application that is using the .net 3.5 compact
I have a windows form which calls other windows form that work within my
i want to get output from windows form to the calling application that is
i want to show the folder contents in my windows form from where user
I have few questions, I want to show the alert window on my Update
I want to show a modal dialog/pop-up window when the user has not filled
I just want to show more than one Watch window. There, they say that
I am working on window application using c# . i want to show my

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.