473,569 Members | 2,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using ApplicationCont ext rather than running a form. Application not quitting

While trying to run an ApplicationCont ext rather than creating a new form, I
noticed that the application never quits.
I stripped the code out of it down to the bone and it still doesnt exit.
I put a break in the OnApplicationEx it function, it's never reached
Any idea what i'm missing?

public class MyApplication : ApplicationCont ext
{

public MyApplication()
{
Application.App licationExit += new EventHandler(th is.OnApplicatio nExit);

foobar();
foobar();

ExitThread();
}

private void OnApplicationEx it(object o, System.EventArg s e)
{
DoSomething();
}
[STAThread]
static void Main()
{
Application.Run (new MyApplication() );
}// function
Aug 7 '06 #1
2 5643
A call to Application.Exi t maybe.

Do you call it from somewhere ?

Regards,
Tasos

Chukkalove wrote:
While trying to run an ApplicationCont ext rather than creating a new form, I
noticed that the application never quits.
I stripped the code out of it down to the bone and it still doesnt exit.
I put a break in the OnApplicationEx it function, it's never reached
Any idea what i'm missing?

public class MyApplication : ApplicationCont ext
{

public MyApplication()
{
Application.App licationExit += new EventHandler(th is.OnApplicatio nExit);

foobar();
foobar();

ExitThread();
}

private void OnApplicationEx it(object o, System.EventArg s e)
{
DoSomething();
}
[STAThread]
static void Main()
{
Application.Run (new MyApplication() );
}// function
Aug 7 '06 #2
I tried microsofts sample code in their ApplicationCont ext topic. They run
two forms which maintain a form counter on close.
When the form counter reaches zero ExitThread() is called, the
OnApplicationEx it function is called and the application closes down.
I dont know if it might be something to do with having opened some forms,
but when i use my own forms I get this problem too.
I maybe don't understand what's going on in the background.
Aug 7 '06 #3

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

Similar topics

13
6072
by: Andrew | last post by:
I use conditional compiler constants, set through the VBA IDE in Tools, <projectname> Properties, that I refer to throughout my code to control which code is used during development, and which during production. Usually, this only wraps code used to control quitting the whole app versus just shutting a form, but it can also control many...
0
1545
by: Alireza Haghshenass | last post by:
Dear All, I am facing a problem which I could not solve. I am writing an application which uses a notify icon and a context menu bound to it to show modal dialog forms. When these forms is shown there is no problem but while I am closing any of them which is shown in modal form throw an exception which is described below : Message :...
0
4188
by: Ralf Gedrat | last post by:
Hello! I have a Application, this throws after some time following exception: Item has already been added. Key in dictionary: "- 1" key being added: "- 1" I use Application.Run with ApplicationContext. This error message comes from deeper levels must be thrown (mscorlib.dll?!) ?.
1
2279
by: bixbm | last post by:
Hey all, I'm developing a tray application and want the tooltip to display status info but it evidently has a max size of 64 characters. The application uses the ApplicationContext directly since it is a form-less utility. Does anyone know how I can override or extend the ApplicationContext.Text field to increase the ApplicationContext...
1
5353
by: Carlos | last post by:
I'm getting RPC error when I try to register analys32.xll in the VB program. ErrorCode=-2147417851 Message="El servidor lanzó una excepción. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))" Source="Microsoft.Office.Interop.Excel" StackTrace: at Microsoft.Office.Interop.Excel.ApplicationClass.RegisterXLL(String Filename) at...
8
3912
by: Gary | last post by:
I'm using an Act database. I was stuck on this a year ago and am still having trouble. I have three bits of code like so : - act.CActAppObj objACT = new act.CActAppObj(); act.CAIBaseView objBaseView = new act.CAIBaseView(); act.CAIViews objViewsCollection = new act.CAIViews();
3
2208
by: KaNos | last post by:
Hello, I'm programming an C# application which uses Automation. The problem is when I quit the application a ghost of excel is always running (Can be seen in all processes with th task manager). What is the solution ? Thanks
5
16386
by: Rajkiran R.B. | last post by:
I want to log in to a website using C# code.. The main aim is to check whether the username and password I provide is correct or not. I used the following code bool somefunction() { string username = textbox1.text;
6
4481
by: Scott Gravenhorst | last post by:
Windows XP SP3 My application is set to open a SaveFile dialog when an exit is requested. When I click the app's close button, the save dialog opens, but when I click to change the folder, the exception occurs pointing to FileSaveDialog1.ShowDialog(). The exception also indicates some problem with system.drawing.dll. The exception text...
0
7697
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
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...
0
7924
Oralloy
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. ...
1
7672
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...
0
7968
tracyyun
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...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
937
bsmnconsultancy
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...

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.