473,698 Members | 2,611 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 5648
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
6090
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 other things. However, as part of the build before delivering an update, I have to remember to...
0
1560
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 : External component has thrown an exception. StackTrace : at...
0
4199
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
2285
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 tooltip size? Thanks! bixbym
1
5365
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 WindowsApplication9.Form1.Button1_Click(Object sender, EventArgs e) in C:\Documents and...
8
3924
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
2210
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
16390
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
4495
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 is: "Attempted to read or write protected memory. This is often an
0
8610
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,...
0
9031
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8873
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7740
agi2029
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...
1
6528
isladogs
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...
0
5862
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4623
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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 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.