Hack Forums
[.NET] How to have an invisible start up form ? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] How to have an invisible start up form ? (/showthread.php?tid=5825635)



How to have an invisible start up form ? - Hackoo - Apr 16, 2018

Hi  ✌
I would like a start up form to be invisible, but still have a notification icon in the tray visible for this form ?
Adding me.hide into the form_load doesn't work.  🙃
Any Ideas ? Thank you !


RE: How to have an invisible start up form ? - knetterbot - Apr 16, 2018

This can be done by changing the transparency and the borderstyle.

This should do the job:
Me.TransparencyKey = Me.BackColor
Me.FormBorderStyle = FormBorderStyle.None


RE: How to have an invisible start up form ? - AlexOthelionel - Apr 16, 2018

Don't forget that you can also hide your form when alt-tabing by setting ShowInTaskBar to False.


RE: How to have an invisible start up form ? - PolarisGang - Apr 16, 2018

Code
'1
TransparencyKey = BackColor
FormBorderStyle = FormBorderStyle.None

'2
Visible = False

'3
Hide()

'Additional
ShowInTaskBar = False
You can simply remove the form if you don't want it and run the application as a background process.


RE: How to have an invisible start up form ? - maype - Apr 16, 2018

(Apr 16, 2018 04:54 AM)knetterbot Wrote:  This can be done by changing the transparency and the borderstyle.

This should do the job:
Me.TransparencyKey = Me.BackColor
Me.FormBorderStyle = FormBorderStyle.None

I would use a simple class declaration and compile it with a compiler as a WinForm App. The .exe will have less weight and not action after to hide it.

Search for CodeDOM Compiler.


RE: How to have an invisible start up form ? - Dalvik - Apr 17, 2018

In C# you can create a Console Application and later set it to a Windows Forms application in the project settings.
In VB.net it is a bit trickier since there is no default Program class file. Here is a quote from StackOverflow:
Quote:By default, VB.NET applications use the mysterious Windows Application Framework which means that the build process adds an entry point for you which automatically runs whichever form you use as the main form. You can access these settings via Project Properties > Application > Windows application framework properties.

If you don't want to use the framework, un-check the Enable application framework check box and then select that you want to use Sub Main as your Startup object. Then you can create a module with a Public Sub Main method which will be the entry point to the application, just like in Program.cs in C#.

EDIT: This will not spawn a form at all. You can later spawn a form when/if needed.


RE: How to have an invisible start up form ? - breaker1911 - Apr 17, 2018

first, you can set opacity = 0
second . set your viewontaskbar or something (i don't remember cuz i don't work on vb anymore) to FALSE

or just add this code like into the form loads
Code
me.[yourformname].opacity = 0
NotifyIcon1.Icon = SystemIcons.Application
NotifiIcon1.BalloonTipIcon = ToolTipIcon.Info
ShowInTaskbar = false

so its will be like this
Code
private stub form1.load(sender as object, byval e as eventargs) handle myform.load
me.[yourformname].opacity = 0
NotifyIcon1.Icon = SystemIcons.Application
NotifiIcon1.BalloonTipIcon = ToolTipIcon.Info
ShowInTaskbar = false
end sub

in case you have another question, send me an PM and i may help you.