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(obje ct sender, System.EventArg s e)
{
this.WindowStat e = 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 51698
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("user 32.dll")]
public static extern int SetWindowLong( IntPtr window, int index, int
value);
[DllImport("user 32.dll")]
public static extern int GetWindowLong( IntPtr window, int index);
const int GWL_EXSTYLE = -20;
const int WS_EX_TOOLWINDO W = 0x00000080;
const int WS_EX_APPWINDOW = 0x00040000;
3. I copied this code in the Form1_Load method
this.WindowStat e = System.Windows. Forms.FormWindo wState.Minimize d;
this.Visible = false;
this.ShowInTask bar = false;
int windowStyle = GetWindowLong(H andle, GWL_EXSTYLE);
SetWindowLong(H andle, GWL_EXSTYLE, windowStyle | WS_EX_TOOLWINDO W);
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************ **@exisconsulti ng.com> wrote
in message news:e$******** ******@TK2MSFTN GP11.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************* *@exisconsultin g.com
"amil [c#newbie]" <am****@hotmail .com> wrote in message news:%2******** ********@TK2MSF TNGP11.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(obje ct sender, System.EventArg s e) { this.WindowStat e = 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
Form1.Visible = False
Load (Form1)
|
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: "You entered an
expression that requires a form to be the active window".
I have a popup form set to open when the DB is opened. On the open event of
the form, I have the following code: fSetAccessWindow (SW_HIDE) as
instructed on the web page....
|
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 form won't hide itself. This is the main form of the
application.
|
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 program starts.
Matthew
|
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 being shown?
Thanks
BrianDH
| |
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 Form_Open(Cancel As Integer)
me.visible = false
end 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:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtsksettingformtobeinvisibleatitsinception.asp
The problem with this method is that when I call the Hide() function on
f1 it causes the form to close which exits the app. Any other
approaches to hiding the form at startup would be appreciated.
Thanks
|
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
having to be minimized.
I have tried putting
this.Hide();
in the Load method, but that doesn't work (the form still comes up and needs
|
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 you can show the 'database
window', the same button that you have to press to show the database
window opens a small modal form which has one button which will return
you to the menu system, but I also want it to close the database
window!
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |