Quit a process exe

Quit a process exe

Postby Silvio.Falconi » Fri May 29, 2020 2:33 pm

when I close the main window from the "X" the application is closed, but in reality the exe remains in memory on the computer causing memory leaks.
I can't find the error.

Image


In reality the problem occurs when the Tcalex () class is called: everything is working but if the final user closes the main window the exe remains in memory which is not the case for the other procedures.

the problem does not always manifest itself
there are also moments when if the user closes the window from the "X" it also closes the exe in memory

if tcalex is open in the "Month" view, the exe closes, if instead tcalex is open in the "Daily" or week view
then the exe does not close even if the user returns to the Month view

By chance is there a function or a procedure that goes to check if the exe is still in memory and if it closes it?

I made some checks and I saw there is something no closed on TMonthView or TweekView while on tdayview is ok
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6785
Joined: Thu Oct 18, 2012 7:17 pm

Re: Quit a process exe

Postby Silvio.Falconi » Fri May 29, 2020 3:15 pm

Now I found a function
it seems to close the exe

HB_GCALL( .t. ) at Begin of Main.prg

then
MemoryFlush() when the exe must be closed

FUNCTION MemoryFlush()
SetProcess( -1, -1, -1 )
RETURN NIL

DLL32 Function SetProcess( hWnd As LONG, nMinWorkingSpace As LONG, nMaxWorkingSpace As LONG ) As LONG PASCAL From "SetProcessWorkingSetSize" Lib "Kernel32.dll"


But I not Know if it run for ever
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6785
Joined: Thu Oct 18, 2012 7:17 pm

Re: Quit a process exe

Postby MOISES » Sat May 30, 2020 8:56 am

Silvio:

Code: Select all  Expand view
  PostQuitMessage(0)

   QUIT
 



https://docs.microsoft.com/en-us/window ... uitmessage
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: Quit a process exe

Postby Silvio.Falconi » Thu Jun 04, 2020 11:00 am

I have tried both with:

Code: Select all  Expand view
PostMessage (0)
quit


i tried with
Code: Select all  Expand view
HB_GCALL (.t.)
  MemoryFlush ()


always the same remains the "exe" file in memory (in the management of windows activities ) as you can see in this figure

Image


I have a simple window which I then activate with
Code: Select all  Expand view

   ACTIVATE WINDOW :: oWndMain
       VALID :: ExitFromX ()

 



on exitfromX method there is this

Code: Select all  Expand view
if msgYesNo( i18n("¿exit?") )
   
      SetWinCoors( ::oWndMain, ::cIniFile )

       MemoryFlush()
      RETURN .t.
   end



Please Help Me , this happened only with Tcalex class !!!

I don't think anyone who uses tcalex doesn't have this problem
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6785
Joined: Thu Oct 18, 2012 7:17 pm

Re: Quit a process exe

Postby Otto » Fri Jun 05, 2020 10:36 am

Hello Silvio,
maybe you can check the class. Is your class registerd?
Maybe this from Petzold's book help?
Best regards,
Otto


Image

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6015
Joined: Fri Oct 07, 2005 7:07 pm

Re: Quit a process exe

Postby Silvio.Falconi » Fri Jun 05, 2020 5:07 pm

Otto wrote:Hello Silvio,
maybe you can check the class. Is your class registerd?
Maybe this from Petzold's book help?
Best regards,
Otto




Dear Otto,
what question you ask me
I use Tcalex class on a Dialog ( style ws_child) and this dialog is on a Window ( no Mdi)

this class is registred ?

do not be a professor with me, it is not necessary to show me books and texts,
the error is in the Tcalex which if inserted in a window does not come out if instead it is inserted in a dialog creates problems
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6785
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 16 guests