fbpx

Replacement for Quit() ?

More
1 year 4 months ago #1 by Frank Müßner
Replacement for Quit() ? was created by Frank Müßner
Hi,

what is the correct Replacement for _Quit() or Quit() or App:Quit() ?
No call is not terminated the Program.

Frank

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #2 by Nick Friend
Replied by Nick Friend on topic Replacement for Quit() ?
If you're using WPF you can use Application.Shutdown(), which then allows you to use Application.Current.ShutdownMode to define under what circumstances the app should exit.

Don't know about WinForms, sorry.

HTH

Nick

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago - 1 year 4 months ago #3 by Robert van der Hulst
Replied by Robert van der Hulst on topic Replacement for Quit() ?
Frank

For windows forms you can use Application.Exit()
And there is also Environment.Exit()

Robert

XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.
Last edit: 1 year 4 months ago by Robert van der Hulst.

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #4 by Frank Müßner
Replied by Frank Müßner on topic Replacement for Quit() ?
Hi Robert,

not for WinForms.
Transported VO Code. There is SELF:Quit(), but i dos not work.

Frank

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #5 by Chris Pyrgas
Replied by Chris Pyrgas on topic Replacement for Quit() ?
Hi Frank,

Normally App:Quit() should work, can you please give us some more info on what is happening?
Does it give you a runtime error message, or does it not just terminate the app?
When are you calling it? Can you share the code?

Chris

XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #6 by Frank Müßner
Replied by Frank Müßner on topic Replacement for Quit() ?
Hi Chris,

simple not terminate the app.

Method Start()
....
....
LOCAL Starttb AS Textbox
XStools:=XSharp.AClass{}

//Lokale Sqllite Datei erstellen und prüfen
IF ! Createdblokal()
Starttb:=TextBox{,"Schwerer Fehler im Programmablauf","Lokale Datenbank konnte nicht angelegt, oder darauf zugegriffen werden. Bitte beim Support melden.",BUTTONOKAY}
Starttb:Show()
_Quit()
ENDIF

//Test Quit
SELF:Quit()

...
pszCommandLine:=GetCommandLine()

Frank

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #7 by Wolfgang Riedmann
Replied by Wolfgang Riedmann on topic Replacement for Quit() ?
Hi Frank,

IMHO this is an error in the VO GUI classes - sometimes the application hangs somewhere, and is visible only in the task manager. And maybe this is more visible with X# compiled programs.
My own ported VO MDI application behaves exactly as its VO pendant.

I have this issue for years now - and in all of my VO applications.

Wolfgang

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #8 by Frank Müßner
Replied by Frank Müßner on topic Replacement for Quit() ?
Hi Wolfgang,
i don´t understand what you mean.
With VO i can abort the app with call Quit() or SELF:Quit(). The sample that i have posted look in the Start() Method for necessities, and when not available the App have to Quit.
X# does not quit the app and perform the following code.

Frank

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #9 by Wolfgang Riedmann
Replied by Wolfgang Riedmann on topic Replacement for Quit() ?
Hi Frank,

a ported VO application does not use the .NET GUI (WinForms/WPF) classes, but the VO GUI classes.

Therefore the source for your problem is to search there.

Wolfgang

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #10 by Frank Müßner
Replied by Frank Müßner on topic Replacement for Quit() ?
Hi to all,

I have found that only when debug the App, Self:Quit() is not perform.
When run the app it work´s like in VO. :-)

Frank

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #11 by Chris Pyrgas
Replied by Chris Pyrgas on topic Replacement for Quit() ?
Hi Frank,

I think the difference between VO and x# is in the _Quit() function. Unfortunately I don't know exactly what it does in VO, but in the vulcan runtime it is implemented by calling the CloseMainWindow() method of the current process and this method sends a couple messages to the window to do it. Most probably in VO _Quit() does something little different.

My suggestion is to terminate the app with more control over what is happening exactly, for example by explicitly closing the main window of the app, or terminating the main execution loop if you have control over this etc.

Chris

XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #12 by Robert van der Hulst
Replied by Robert van der Hulst on topic Replacement for Quit() ?
Chris, Frank,

If I remember correctly then VO the _Quit function in VO does:
- call Axit on all active objects
- releases the dynamic memory
- releases the static memory
- releases other memory allocated by the runtime
- calls ExitProcess with an exit code
I may have forgotten something <g>.

Robert

XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.