Solved

How to quit app at interrupt time?

Posted on 1997-05-11
2
204 Views
Last Modified: 2013-12-26
null
0
Comment
Question by:danieln
2 Comments
 

Author Comment

by:danieln
ID: 1291457
Edited text of question
0
 
LVL 1

Accepted Solution

by:
PAD earned 200 total points
ID: 1291458
You CAN'T quit an application from an Interrupt routine. This will works in some case but will freez your Mac in the other case.
At interrupt time, you're not sure that the current Heap is your application heap (and in fact often its was not). So as ExitToShell refer to the current application heap...

The best way to do that, i think is to use AppleEvent. You can send to your application a Quit Application event that willbe correctly executed. This a simple and you can find sample code on Apple Dev CD or on internet Apple Dev server.

The only thing to do is to make sure you store the process reference for your appl at beginning and store it in Global so that you can refer to this process serial number at interrupt time to launch an AppleEvent.

Another way is to build a thread that kill your application. And to make it sleep at startup. Then at interrupt time you just have to wake-up this thread, and this thread call exittoshell. You also have to store the global application process serial number.

Good luck...
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 92
sumNumber challenge 16 138
zeroMAx challenge 20 111
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 103
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question