Solved

How to quit app at interrupt time?

Posted on 1997-05-11
2
198 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

929 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now