473,320 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How To Have a Form Not Open Upon Executing

I have an application that I am writing that is to run on the users system
tray. I can get the icon and application to run on the system tray, no
problem. However: when I run the app: a form window also opens, although
nothing is displayed on this form. How do I get it to run without the main
form window from opening as well?

Thanks
Andy
Nov 17 '05 #1
2 1090
Following is cut from my application.

My form is hiding in taskbar on startup.
The following also cures a bug in current .net/visual studio where Windows
won't shut down if the application is minimized. (the WndProc bit)

Form properties:
ShowInTaskbar to false
WindowState = minimized

private void frmOptions_Load(object sender, System.EventArgs e)
{
notifyIcon1.Icon = this.Icon;
}

#region WINDOWMINIMIZE
private void frmOptions_Resize(object sender, System.EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
{
ShowInTaskbar = false;
Hide();
}
}
private void mnuOptions_Click(object sender, System.EventArgs e)
{
Show();
WindowState = FormWindowState.Normal;
ShowInTaskbar = true;
BringToFront();
}
private bool DOCLOSE = false;
private void mnuClose_Click(object sender, System.EventArgs e)
{
DOCLOSE = true;
Close();
}
private void frmOptions_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
if (DOCLOSE == false)
{
e.Cancel = true;
WindowState = FormWindowState.Minimized;
}
}
private void cmdMinimize_Click(object sender, System.EventArgs e)
{
Close();
}
private void frmOptions_SizeChanged(object sender, System.EventArgs e)
{
if (WindowState == FormWindowState.Normal)
Settings.OptionBounds = ClientSize;
}
protected override void WndProc(ref Message m)
{
// Look for wmquerysession message
if (m.Msg == 0x11)
DOCLOSE = true;
// Call the base.
base.WndProc(ref m);
}
#endregion
Nov 17 '05 #2
Look at this: http://windowsforms.net/articles/not...lications.aspx I
used it as a starting place for my task try application.

--
Thanks
Wayne Sepega
Jacksonville, Fl
"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein

"Andy" <An**@discussions.microsoft.com> wrote in message
news:86**********************************@microsof t.com...
I have an application that I am writing that is to run on the users system
tray. I can get the icon and application to run on the system tray, no
problem. However: when I run the app: a form window also opens, although nothing is displayed on this form. How do I get it to run without the main form window from opening as well?

Thanks
Andy

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Pete | last post by:
I have form/select which executes a function using onchange. No problem. However, when I validate the page with a strict HTML 4.01 doctype at http://validator.w3.org, it demands either an action or...
3
by: John Baker | last post by:
Hi: At the outset let me admit that I screwed up! I have built a rather elaborate set of forms and sub forms starting with a client table, and going down to PO and Line item. This works very...
0
by: web1110 | last post by:
Hi again, I am referring an earlier question here trying to enlarge upon the concept I am pursuing.: Each object is a subassembly. They are all significantly different in detail and content...
2
by: jerry.ranch | last post by:
I'm starting to learn about the tab control. How would I write an on open event procedure in VBA, that upon opening of the form, a specific tab opens (say tab 1)? Thanks Jerry
6
by: San | last post by:
Hey, I need to create a form with several text boxes in which users type in key words, press a command button on the form and it opens a matching record. Thanking you in advance.
7
by: fniles | last post by:
I am using VB.Net 2003 and MS Access (connecting using OleDBConnection). I read using DataAdapter and DataSet, not DataReader. When many people try to access the database at the same time, I get...
4
by: rn5a | last post by:
I am storing the physical path of images, along with 3 more columns, in a MS-Access DB table. I want to provide users the option to change this physical image path (as well as the records in the...
4
by: Jonny Relentless | last post by:
After adding a form to a C# program, I am unable to use it. I want to use form1 as a sort of menu, so that when the user clicks a button, form1 will close and form2 (or form3, etc) will open. What...
5
by: caconklin | last post by:
Access 2003, Windows XP. Currently I am able to open a form - case form - based upon information input by the user in another form - search form. I would like to be able to open the case form...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.