Jump to content


Photo

Closing windowless unigui application


  • Please log in to reply
3 replies to this topic

#1 Rav

Rav

    Active Member

  • Members
  • PipPipPip
  • 87 posts

Posted 16 May 2016 - 10:48 AM

Hello,

I have a windowless application with integrated UniGui and I need it to close from one of its threads.
Without UniGUI I didn't use Application.run, didn't handle messages and instead of it I used a special thread which checked globally defined variable ApplicationTerminated that could be set out of everywhere.

 

Now with UniGUI I need to stop Application.run from another thread. All the ways mentioned from this topic are not working:

Application.Terminate (no result);
UniApplication.Terminate (access violation);
MainModule.UniMainModule.Terminate (access violation)

 

Is there another way of proper closing the application?


  • 0

#2 Bugra Yener Sahinoglu

Bugra Yener Sahinoglu

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 163 posts

Posted 16 May 2016 - 11:33 AM

Hi;

 

An UniGUI application can be closed from only its events like onclick, not other threads events. That's the reason why you are getting access violation error.


  • 0

#3 Rav

Rav

    Active Member

  • Members
  • PipPipPip
  • 87 posts

Posted 16 May 2016 - 03:21 PM

Thanks!

Is there a workaround? UniThreadTimer? Server Module thread?


  • 0

#4 Daryl McMurray

Daryl McMurray

    Member

  • uniGUI Subscriber
  • PipPip
  • 17 posts
  • LocationOntario, Canada

Posted 13 February 2018 - 06:20 PM

try this

 

UniApplication.Terminate('GoodBye');  // to put the app in a closed state in the browser

PostThreadMessage(MainThreadID,wm_quit,0,0);  // will tell the main application to terminate 
 
Use only for testing though... or users will be able to terminate the server.exe

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users