Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Topmost windows

Topmost windows

Scheduled Pinned Locked Moved C#
helpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    S O S
    wrote on last edited by
    #1

    There's an always on top window in my app, but I have an annoying problem with it. The window is just a normal window with TopMost set to true. Now this works fine, but I want the window to dissappear if another app gets focus. I tried pussing topwindow.Visible = true; in the Activate event and topwindow.Visible = false; in the Deactivate event, but these events get called even when another window in my app gets actiavted, so whenever I click on the topmost window, it dissappears because the main window gets deactivated. Is there a way to prevent the topmost window from getting focus at all? (But still use it as normal, just no focus. By normal I mean still have it receive mouse clicks.) Or some way to determine what window is getting focus in the Deactivate event? Or some other way to fix this?

    L 1 Reply Last reply
    0
    • S S O S

      There's an always on top window in my app, but I have an annoying problem with it. The window is just a normal window with TopMost set to true. Now this works fine, but I want the window to dissappear if another app gets focus. I tried pussing topwindow.Visible = true; in the Activate event and topwindow.Visible = false; in the Deactivate event, but these events get called even when another window in my app gets actiavted, so whenever I click on the topmost window, it dissappears because the main window gets deactivated. Is there a way to prevent the topmost window from getting focus at all? (But still use it as normal, just no focus. By normal I mean still have it receive mouse clicks.) Or some way to determine what window is getting focus in the Deactivate event? Or some other way to fix this?

      L Offline
      L Offline
      LovelyXiaoXinXin
      wrote on last edited by
      #2

      Nice to meet you here. I hope I will do help you . First Create a class with a namespace test namespace test { public class GlobalVars { public static bool blVisible; public GlobalVars() {} } } In topwindows ,set a Timer Component which watch the test.GlobalVars.blVisi ble , When it is true , Ignore it , when it is false , set Visible to false In the other Window , Set the blVisible to control the Global Variables; I hope it will help you

      S 1 Reply Last reply
      0
      • L LovelyXiaoXinXin

        Nice to meet you here. I hope I will do help you . First Create a class with a namespace test namespace test { public class GlobalVars { public static bool blVisible; public GlobalVars() {} } } In topwindows ,set a Timer Component which watch the test.GlobalVars.blVisi ble , When it is true , Ignore it , when it is false , set Visible to false In the other Window , Set the blVisible to control the Global Variables; I hope it will help you

        S Offline
        S Offline
        S O S
        wrote on last edited by
        #3

        No, that's not what I need. What I need is to know what window is getting activated, so I don't turn the topmost window invisible when I click on it.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups