Hi all,
I am using the Notify Icon sample that came with .Net Docs and was able
to run it. However, I want to start the form as minimized. I have the
ShowInTaskbar = false and in the this is my code in the form load:
private void Form1_Load(object sender, System.EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
this.Visible = false;
}
This will still display a minimized window title bar near the Windows Start
button.
It does not totally hide the form.
Also, can I remove just the "X" or close button of the form and retain the
minimize/maximize buttons?
TIA. 2 51633
Hi Ignacio,
Thanks for the feedback. The form still shows as a minimized titlebar
just above the Microsoft START button. I changed the code as follows:
1. Added to namespace definitions
using System.Runtime.InteropServices;
2. Declared P/Invoke in my Form1 class
[DllImport("user32.dll")]
public static extern int SetWindowLong( IntPtr window, int index, int
value);
[DllImport("user32.dll")]
public static extern int GetWindowLong( IntPtr window, int index);
const int GWL_EXSTYLE = -20;
const int WS_EX_TOOLWINDOW = 0x00000080;
const int WS_EX_APPWINDOW = 0x00040000;
3. I copied this code in the Form1_Load method
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.Visible = false;
this.ShowInTaskbar = false;
int windowStyle = GetWindowLong(Handle, GWL_EXSTYLE);
SetWindowLong(Handle, GWL_EXSTYLE, windowStyle | WS_EX_TOOLWINDOW);
I noticed that the Min/Max buttons are gone as well.
Hi Nicholas,
Thank you for the feedback.
I think this proves that I am indeed a newbie. If I change the WindowState
= Minimized
in the form properties during design time, it actually hides the form when I
run the
code. No other code was necessary.
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:e$**************@TK2MSFTNGP11.phx.gbl... amil,
I don't think that you can remove the "X" button, but I do think that you can disable it. Check out knowledge base article Q184686, titled "HOWTO: Disable the Close Option on Control Menu of a VB Form", located at (watch for line wrap):
http://support.microsoft.com/default...b;en-us;184686
While this applies for VB6, it will show you which API calls you have
to make in order to disable the box.
As for hiding the form, you should probably override the CreateParams property so that it returns a CreateParams instance that has the
appropriate window styles set so that your form is initially minimized.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - ni**************@exisconsulting.com
"amil [c#newbie]" <am****@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl... Hi all,
I am using the Notify Icon sample that came with .Net Docs and was able to run it. However, I want to start the form as minimized. I have the ShowInTaskbar = false and in the this is my code in the form load:
private void Form1_Load(object sender, System.EventArgs e) { this.WindowState = FormWindowState.Minimized; this.Visible = false; }
This will still display a minimized window title bar near the Windows Start button. It does not totally hide the form.
Also, can I remove just the "X" or close button of the form and retain
the minimize/maximize buttons?
TIA.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: genetic.error |
last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up
before...
The VS.Net MSDN file seems to state that the following should work:
Form1.Show
Form1.Visible = True
Form1.Hide...
|
by: Mark |
last post by:
Hi All,
I am trying to use the function found on the MVP site
http://www.mvps.org/access/api/api0019.htm to hide the Access window. I must
be missing something as I keep getting an error message:...
|
by: Kirk Graves |
last post by:
Can anyone tell me why this code does not work?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.Hide()
End Sub
If runs, but the...
|
by: Matthew |
last post by:
The following code does not hide the form. Any ideas why? Also, is there a
workaround?
I have VB.NET 2003.
I have a system tray icon, and want to have that be the only thing showing
when the...
|
by: BrianDH |
last post by:
Hi
I have an application with 3 windows forms. One of which I load at startup
but hide, then show/hide based on users click. How can I test to see if the
windows is hidden, or is at the moment...
| |
by: Gil |
last post by:
on start up i have a form that opens but i want it to stay hidden.
i tried a few things so far and i had no luck.
i did :
Private Sub Form_Load()
me.visible = false
End Sub
Private Sub...
|
by: MJB |
last post by:
I have an application that I need to hide at startup in the system tray.
I found this article on how to do it:...
|
by: Raj Wall |
last post by:
Hi,
I have an application which, when running, is to be seen only in the system
tray as a right-clickable icon.
However I want the main Form window itself to immediately disappear without...
|
by: Nick 'The database Guy' |
last post by:
Hi People,
How do you go about hiding the database window. The reason for doing
this is that sometimes have to manually add data to tables. I have a
fully interatctive menu system from which...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |