CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    How does an application kill itself?

    Hi. I've written a java program which can be run as either an applet or application (nothing special there ;-))

    I have a "close" button on my main window, which I'd like to grey out if it's running as an applet, but enable if running as an application.

    If the user presses it while running as an application I'd like to terminate my program immediately.

    Q1: I was going to check if it's running as an app or applet by setting a flag in the init and main functions. Is this the best way or is there a runtime function I can call? I would prefer a runtime function.
    Q2: How do I tell my application to close immediately? Calling destory does not seem to do anything.

    Any help would be gratefully appreciated.

    Thanks,

    Tom.


  2. #2
    Join Date
    Sep 1999
    Location
    Madurai , TamilNadu , INDIA
    Posts
    1,024

    Re: How does an application kill itself?

    > How do I tell my application to close immediately? Calling destory does not seem to do anything.

    Call "System.exit(0);"

    I dont have answer for your first question. There are lots of complicated solution for your
    first question. I will post it later. ( One suggession is , getAncestorParent() and do
    toString() with the return value and check what you are getting for both Frame and Applet ).

    Poochi




  3. #3
    Guest

    Re: How does an application kill itself?

    Works great!

    Thanks a lot.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured