Solved

How to quit app at interrupt time?

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

Author Comment

by:danieln
Comment Utility
Edited text of question
0
 
LVL 1

Accepted Solution

by:
PAD earned 200 total points
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

763 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

6 Experts available now in Live!

Get 1:1 Help Now