Quit a process exe

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Quit a process exe

Post by Silvio.Falconi »

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
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Quit a process exe

Post by Silvio.Falconi »

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
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
MOISES
Posts: 824
Joined: Wed Aug 22, 2007 10:09 am

Re: Quit a process exe

Post by MOISES »

Silvio:

Code: Select all

   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
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Quit a process exe

Post by Silvio.Falconi »

I have tried both with:

Code: Select all

PostMessage (0)
quit
i tried with

Code: Select all

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

   ACTIVATE WINDOW :: oWndMain
       VALID :: ExitFromX ()

 

on exitfromX method there is this

Code: Select all

 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
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: Quit a process exe

Post by Otto »

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

********************************************************************
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Quit a process exe

Post by Silvio.Falconi »

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
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply