User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Detecting a Shut Down or Restart

  1. #1
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export ModuleInstall CreatorInstall Creator Pro

    Join Date
    Jun 2006
    Location
    UK
    Posts
    294
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Detecting a Shut Down or Restart

    My application always runs in the background but I'm getting problems if the machine is just Shut Down without the application being closed first.

    What I need to do is for the application to detect that a Shut Down or Restart in Windows has occurred so it can then close itself cleanly.

    Is there a way to do this? "End of Application" command doesn't seem to work with a Shut Down/Restart.

    Many Thanks,
    Marc

  2. #2
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    2,996
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)

    Re: Detecting a Shut Down or Restart

    Maybe write a value in an INI when the app is properly closed. Then when your application starts, read that value and reset it.

  3. #3
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export ModuleInstall CreatorInstall Creator Pro

    Join Date
    Jun 2006
    Location
    UK
    Posts
    294
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Re: Detecting a Shut Down or Restart

    When I use "End of Application" commands etc these only work if I "cleanly" close the app.
    However, when a Windows Shut Down is initiated and the application is still running any of the commands I use to detect and exit cleanly don't work. This would mean that I couldn't write to an ini file

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Jaffob's Avatar
    Join Date
    May 2008
    Location
    USA
    Posts
    1,833
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Detecting a Shut Down or Restart

    Haven't tested this, but the "Close Window has been Selected" condition might work to detect a shutdown (Special Object -> Application Menu). This action intercepts closing, and usually all applications are closed this way during a shutdown. So it's possible it would be triggered while the computer was shutting down, although you would also need to sort this out from when the user closes the application via the Close button.

    Of course, if the shutdown was forced (e.g. if the user held down their computer's power button), this condition wouldn't be triggered.

  5. #5
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export ModuleInstall CreatorInstall Creator Pro

    Join Date
    Jun 2006
    Location
    UK
    Posts
    294
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Re: Detecting a Shut Down or Restart

    Thanks Jaffob - I've tried the "Close Window has been Selected" but unfortunately it doesn't detect a shutdown.

  6. #6
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    2,996
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)

    Re: Detecting a Shut Down or Restart

    Quote Originally Posted by madmac
    When I use "End of Application" commands etc these only work if I "cleanly" close the app.
    Yes, that's why in that case only I suggest you to write a value in an INI. At the next startup if that value is present in the INI it means that the app was properly closed (then reset the INI). On the contrary if that value is not present in the INI, that means that the app was NOT properly closed.

    I've not tried it, but I think that it will work. See the pseudo-code below:
    Code:
    • End of application
    - Write value "closed" in INI
    
    • Start of application
    + If value "closed" is written in INI
    - Write value "reset" in INI
    - Do what you need when the app was properly closed
    
    • Start of application
    + If value "closed" is NOT written in INI
    - Do what you need when the app was NOT properly closed

  7. #7
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export ModuleInstall CreatorInstall Creator Pro

    Join Date
    Jun 2006
    Location
    UK
    Posts
    294
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Re: Detecting a Shut Down or Restart

    Quote Originally Posted by Olivier
    Quote Originally Posted by madmac
    When I use "End of Application" commands etc these only work if I "cleanly" close the app.
    Yes, that's why in that case only I suggest you to write a value in an INI. At the next startup if that value is present in the INI it means that the app was properly closed (then reset the INI). On the contrary if that value is not present in the INI, that means that the app was NOT properly closed.

    I've not tried it, but I think that it will work. See the pseudo-code below:
    Code:
    • End of application
    - Write value "closed" in INI
    
    • Start of application
    + If value "closed" is written in INI
    - Write value "reset" in INI
    - Do what you need when the app was properly closed
    
    • Start of application
    + If value "closed" is NOT written in INI
    - Do what you need when the app was NOT properly closed
    Yes, thinking about it in more detail that could possibly work.
    I'll let you know how I get on - thank you

  8. #8
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export ModuleInstall CreatorInstall Creator Pro

    Join Date
    Jun 2006
    Location
    UK
    Posts
    294
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Re: Detecting a Shut Down or Restart

    Unfortunately, this doesn't work as I'm also using Lacewing.
    I need to exit cleanly before the shut down or it just won't work.

    Windows must use an event or process that it calls before a Shut Down takes place. I just need to be able to trap that event and then exit cleanly.

    All ideas welcome

  9. #9
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Detecting a Shut Down or Restart

    Is this because of the lacewing server bug that leaves you in the channel if you don't disconnect cleanly?

  10. #10
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export ModuleInstall CreatorInstall Creator Pro

    Join Date
    Jun 2006
    Location
    UK
    Posts
    294
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Re: Detecting a Shut Down or Restart

    That's the one.
    If I can detect a shut down in my client app though I can make it disconnect cleanly.
    Yves has suggested using the WinMessPro object

Page 1 of 2 1 2 LastLast

Similar Threads

  1. shut down monitor is possible?
    By daniele in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 11th January 2013, 09:42 PM
  2. [Bug] Restart Frame
    By ProdigyX in forum Android Export Module Version 2.0
    Replies: 0
    Last Post: 3rd May 2012, 04:05 AM
  3. Shut off after testing on the ipad
    By Shadeve in forum iOS Export Module Version 2.0
    Replies: 0
    Last Post: 28th August 2011, 11:35 PM
  4. Shut Down Object
    By Gerblegod7 in forum Extension Development
    Replies: 4
    Last Post: 23rd January 2007, 06:31 PM

Posting Permissions

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