Jump to content



Photo
- - - - -

Setquithandler()


  • Please log in to reply
1 reply to this topic

#1 happy

happy

    Newbie

  • Members
  • Pip
  • 13 posts

Posted 11 November 2011 - 01:32 PM

Hi All,

Could someone please confirm if SetQuitHandler() works? And if so, when is it called?

1) Is it when a user presses <span class=MENU' /> to go to the calculator's main menu?

2) Will it be called when the calculator is switched off?

Or if you could comment on my problem:

I have an addin with a AddIn_main which has a while(1) with a GetKey(). The user, once he enters my addin, can get out of it by pressing <span class=MENU' />. Re-entering the addin takes him back to the same screen from where he left. (This feels like an ALT-TAB to me. As in, addin is still running in the background. Is that the case?)

There is no explicit Quit/Exit from the addin - reason for doing this was to get around the SDK bug where if you returned from your AddIn_main, then the user had to click and go into another application before coming back to yours. So pressing <span class=MENU' /> is the only way out of the addin.

Now, the question: I'm creating a growabale, dynamic array of structures. I malloc() and realloc() whenever the array grows. I also free() when array elements are removed.

But when do I finally call free()? For the malloc() I did to create the array? Since my addin can't be 'exited from', do I need to bother about this free() at all?

Please help!

Thank you!

#2 PierrotLL

PierrotLL

    Newbie

  • Members
  • Pip
  • 25 posts
  • Gender:Male
  • Location:France

  • Calculators:
    fx9860
    Classpad 330

Posted 15 November 2011 - 03:10 AM

Press <span class=MENU' /> and launch an other app on calculator (like RUN/MAT), then the function sent to SetQuitHandler will be called before running RUN/MAT app.

And yes, SetQuitHandler is perfect for your final free() :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users