Jump to content
uniGUI Discussion Forums
Sign in to follow this  
Rav

Closing windowless unigui application

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Thanks!

Is there a workaround? UniThreadTimer? Server Module thread?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×