Hiding a window during startup

Hi all,
    I need to hide my window during startup. Unfortunately I could not find a way to do it.
    Setting this.Visible = false in Constructor on OnLoad event are not working. The window is shown and then it is hidden making a flashing effect during startup.
    I tried few workarounds like ShowInTaskbar = false and WindowState = FormWindowState.Minimized and also Opacity = 0 :) This still makes it possible for the user to switch to this window using <Alt+Tab>. I don't want this behavior.

    Can anyone suggest the way to hide the window during startup

Thanks in advance,
Veera


Answer this question

Hiding a window during startup

  • TimDev

    Your application project will allow you to specifiy a Sub Main() as the startup object for the project.  This is how you start a program without a Form (window).

    In the IDE, click Project -> Properties and under Common Properties - General, set Startup Object to Sub Main.

    Then add a module to your project and create a subroutine called Main in that module.  Now put all your startup code in this subroutine.  Your code can now instansiate a form when you are ready.

  • MylesR

    not at all!
    i dont even know how to make a virus
    i created a button and when you hover over it, you get some kind of dropdown (like combobox)
    with a nice fade-in/fade-out effect(thats why its a form) but its not nice if you hover over it, and you see an extra window with alt+tab 
    anyhoo, it doesnt really matter

  • SteveDyte

    Oh of course not for creating viruses, this is a requirement for my current project to start the application in hidden mode and then activate as and when required.
  • Damon Tivel MSFT

    Sounds like you're making a virus. 
    Anyhow, it's not my place to judge what a (wo)/man uses his/her talents for. Hopefully you'll be kind enough not to send it my way. 

    A simple solution would be to set the property of the form "ShowInTaskbar" to false. Then set the "Opacity" property to zero.

    Hope it works.... or if you're indeed creating a virus... then I hope it doesn't work. Either way... good luck learning.

  • stan_siu

    i have the alt+tab problem aswell
    a solution would be very handy
    please help us !!! ;)

  • Hiding a window during startup