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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:28:15+00:00 2026-06-13T05:28:15+00:00

On my main form I have a ListView that contains a list in LargeIcon

  • 0

On my main form I have a ListView that contains a list in LargeIcon View of the Processes that belong to our software suite. Each LV (ListView) item contains both text and an image which is identical to the icon for our software product for the respective application (i.e. MarinaOffice, LaunchOffice, PureRental, etc…). There is a timer that updates the list based on whether or not the process is found in Process.GetProcesses() method call. When the user clicks on the ListView item for the running process, it should maximize and show the window for that process (i.e WinForms Application) in front of the current process. The code below almost does what I want to accomplish but, in the case where the application that I want to show is already maximized but, behind the windows application that I have on monitor, it does not put the process that I am showing in front of my application. In other words, as long as the application that I am showing using the WIN32 method below is minimized, it works. But, it it is already maximized, it does not.

// Used to Show Other Process Windows
private const int SW_SHOWMAXIMIZED = 3;
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);    

// Method that checks for running apps in our suite every 3000ms
private void timerRunningApps_Tick(object sender, EventArgs e)
{
    CheckRunningapps();
}

// Stripped down version of method that looks for running process in our suite and 
// adds the process name and icon to a ListView on our main form
private void CheckRunningapps()
{
    List<Process> AllProcesses = System.Diagnostics.Process.GetProcesses().ToList();

    listViewRunningApps.BeginUpdate();
    listViewRunningApps.Items.Clear();

    foreach (Process process in AllProcesses)
    {
        ListViewItem lvi = new ListViewItem();
        if (process.ProcessName.ToLower().Contains("marinaoffice"))
        {
            lvi = new ListViewItem("MarinaOffice");
            lvi.SubItems.Add("MarinaOffice");
            lvi.ImageIndex = 1;
            lvi.Tag = process;
            listViewRunningApps.Items.Add(lvi);
        }
    }

    listViewRunningApps.EndUpdate();
}

// Method that actually shows the process.  This works as long as process is minimized
// However, if the process is maximized but, merely behind the current window it does
// not bring it in front.  I have noticed that there is a ShowWindowAsync method.
// Should I use that instead?
private void listViewRunningApps_MouseDoubleClick(object sender, MouseEventArgs e)
{
    ListViewItem lvi = listViewRunningApps.GetItemAt(e.X, e.Y);
    if (lvi != null)
    {
        Process process = (Process)lvi.Tag;
        ShowWindow(process.MainWindowHandle, SW_SHOWMAXIMIZED);
    }
}
  • 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-13T05:28:16+00:00Added an answer on June 13, 2026 at 5:28 am

    Try something like this, I think what is going on is that you are not changing the Window state with ShowWindow Call if the Window is already Maximized in that case you need to also bring it to the front of the Z-Order by using the BringWindowToTop Method.

    Process process = (Process)lvi.Tag; 
    ShowWindow(process.MainWindowHandle, SW_SHOWMAXIMIZED);
    BringWindowToTop(process.MainWindowHandle); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a main form that contains an inner form (that inner form appears
I have created a list form that gets attached to a main form in
In my WPF application, I have a ListView on the main form that displays
I have a main form, and a floating child form that is non-modal. The
I have a Switch to window button on my main form that I'd like
I have main form and some other forms, that can be shown by controls,
I'm trying to make a list view in a page that is liked form
I have a Windows Form with a ListView in Report Mode. For each item
On my main form I have a TPanel containing buttons that act as a
I have a main form that users fill out, and at the bottom there

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.