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

  • Home
  • SEARCH
  • 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 284713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:28:54+00:00 2026-05-12T05:28:54+00:00

I have a windows form application which needs to be the TopMost. I’ve set

  • 0

I have a windows form application which needs to be the TopMost. I’ve set my form to be the TopMost and my application works as I’d like it to except for in one case.

There is a 3rd party application (referred to as player.exe) that displays SWF movie files on a portion of the screen that popup on top of my application.

Using Process Monitor I determined that player.exe application calls

flash.exe <PositionX> <PositionY> <Width> <Height> <MovieFile>

in my case:
flash.exe 901 96 379 261 somemovie.swf

Since flash.exe is being spawned in a new process after my form has been set to the TopMost it is appearing on top of my application.

First thing I did was make my application minimize the player.exe main application window hoping that this would prevent the Flash from appearing also. But, unfortunately it doesn’t… even with the window minimized whenever the flash movie starts it shows up at the pixel location (901,96). I then tried creating a timer to keep setting the form.TopMost property to true every 10ms. This sort of works but you still see a very quick blip of the swf file.

Is there some type of Windows API call which can be used to temporarily prevent player.exe from spawning child processes which are visible? I admit it sounds a little far fetched. But, curious if anyone else has had a similar problem.


Addendum:

This addendum is to provide a reply to some of the suggestions layed out in Mathew’s post below.

For the emergency situation described in the comments, I would look at possible solutions along these lines:

1) How does the third party application normally get started and
stopped? Am I permitted to close it
the same way? If it is a service, the
Service Control Manager can stop it.
If it is a regular application,
sending an escape keystroke (with
SendInput() perhaps) or WM_CLOSE
message to its main window may work.

Easiest way to close the app is to CTRL-ALT-DEL, then kill process. -OR-
The proper way is to Hold ESC while clicking the left mouse button… then input your username and password, navigate some menu’s to stop the player.

There is no PAUSE command… believe it or not.

I don’t think using WM_CLOSE will help since minimizing the application doesn’t. Would that kill the process also? If not, how do you reopen it.

2) If I can’t close it nicely, am I permitted to kill it? If so,
TerminateProcess() should work.

I can’t kill the process for two reasons. 1) Upon relaunch you need to supply username/password credentials… There may be a way to get around this since it doesn’t prompt when the machine is rebooted but… 2) Whenever I kill the process in task manager it doesn’t die gracefully and asks if you want to send an error report.

3) If I absolutely have to leave the other process running, I would try
to see if I can programmatically
invoke fast user switching to take me
to a different session (in which there
will be no competing topmost windows).
I don’t know where in the API to start
with this one. (Peter Ruderman
suggests SwitchDesktop() for this
purpose in his answer.)

I got really excited by this idea… I found this article on CodeProject which provides a lot of the API Wrapper methods. I stopped implementing it because I think that in order for desktop’s to work you must have explorer.exe running (which I do not).

EDIT2: On second thought… maybe explorer.exe isn’t needed. I’ll give it a try and report back.

Edit3: Was unable to get the code in that article working. Will have to put this on hold for a moment.


Answer Summary

As one might have expected, there is no simple answer to this problem. The best solution would be to problematically switch to a different desktop when you need to guarantee nothing will appear over it. I was unable to find a simple C# implementation of desktop switching that worked and I had a looming doubt that I would just be opening a whole new set of worms once it was implemented. Therefore, I decided not to implement the desktop switching. I did find a C++ Implementation that works well. Please post working C# virtual desktop implementations for others.

  • 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-12T05:28:54+00:00Added an answer on May 12, 2026 at 5:28 am

    Setting the TopMost property (or adding the WS_EX_TOPMOST style to a window) does not make it unique in the system. Any number of topmost windows may be created by any number of applications; the only guarantee is that all topmost windows will be drawn ‘above’ all non-topmost windows. If there are two or more topmost windows, the Z-order still applies. From your description, I suspect that flash.exe is also creating a topmost window.

    Aside from periodically forcing your window to the top of the Z-order, I think there is little you can do. Be warned, however, that this approach is dangerous: if two or more windows are simultaneously trying to force themselves to the top of the Z-order, the result will be a flickering mess that the user will likely have to use the task manager to escape.

    I recommend that your program not attempt to meddle with other processes on the computer (unless that is its explicit purpose, e.g. a task manager clone). The computer belongs to the user, and he may not value your program more highly than all others.

    Addendum:

    For the emergency situation described in the comments, I would look at possible solutions along these lines:

    1. How does the third party application normally get started and stopped? Am I permitted to close it the same way? If it is a service, the Service Control Manager can stop it. If it is a regular application, sending an escape keystroke (with SendInput() perhaps) or WM_CLOSE message to its main window may work.

    2. If I can’t close it nicely, am I permitted to kill it? If so, TerminateProcess() should work.

    3. If I absolutely have to leave the other process running, I would try to see if I can programmatically invoke fast user switching to take me to a different session (in which there will be no competing topmost windows). I don’t know where in the API to start with this one. (Peter Ruderman suggests SwitchDesktop() for this purpose in his answer.)

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

Sidebar

Ask A Question

Stats

  • Questions 151k
  • Answers 151k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer you can create a workspace using a command script using… May 12, 2026 at 9:56 am
  • Editorial Team
    Editorial Team added an answer SELECT RIGHT(100+DATEPART(mm, GETDATE()),2) EDIT based on new info - to… May 12, 2026 at 9:56 am
  • Editorial Team
    Editorial Team added an answer A 8 MB dump is probably a bit too big… May 12, 2026 at 9:56 am

Related Questions

I have a Windows Form application built on a data model and a Windows
I am developing an application in which I need to extract the audio from
I will try and explain exactly what I want to achieve first. Imagine two
I am writing an application in C# that needs to run as a service
Ok so we have an upcoming development that will involve a level of off

Trending Tags

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

Top Members

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.