Quit command

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

Quit command

Post by Silvio.Falconi »

Try the command quit I can go out from application but the exe is also on memory

How I can resolve this ?

I try also with this sequence (found on this forum)

but I have problems on Win7 and win10

Code: Select all

 
IF oDlgAuth:nresult == IDOK
      FreeResources()
       sysrefresh()
       DbcloseAll()
       hb_gcall(.t.)
       release all
       clear memory
       postquitMessage(0)
     __Quit()
   ENDIF
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Quit command

Post by nageswaragunupudi »

These two lines

PostQuitMessage( 0 )
QUIT

should be enough.
Please check again.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Quit command

Post by Silvio.Falconi »

on win10 seem run ok
this afternoon I try it on win7
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Patrizio
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy
Contact:

Re: Quit command

Post by Patrizio »

QUIT is the same as __QUIT()

Code: Select all

#command QUIT                    => __Quit()
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Quit command

Post by karinha »

Code: Select all

FUNCTION FINALIZE()

   DBCLOSEALL()

   FreeResources()

   SysRefresh()

   RELEASE All

   Hb_GCAll( .T. )

   CLEAR MEMORY

   PostQuitMessage( 0 )

   IF FILE( "checkres.txt" )
      FErase( "checkres.txt" )
   ENDIF

   CheckRes()

   __QUIT() // or QUIT

RETURN NIL
 
João Santos - São Paulo - Brasil
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Quit command

Post by dutch »

I use ::oSocket and ::oTimer. I have got the problem also.

I start the program with
oTimer:Activate()
Client() -> Connect to Server via Socket.

But It is still in "Task Manager/Processes", when I quit the program. The program do not quit.

I don't know how to quit the program without get stีuck in the memory. I have to end task in Task Manager. How do I fix it?

Code: Select all

DEFINE WINDOW oWnd TITLE 'EZHSC Interface '+cInfVer+' : '+coname+iif(!empty(cBuild),' [B'+cBuild+']','') FROM 0, 0 TO 750, 900 PIXEL ;
         MENU BuildMenu() MDI ;
         ICON oIcon

        oWnd:oFont := oFont

        DEFINE TIMER oTimer OF oWnd; 
                         INTERVAL nLoop ; 
                         ACTION if(lRun,MainLoop(),)

            SET MESSAGE OF oWnd TO "Copyright (C) for EASYFO Co., Ltd. 1998-"+str(year(date()),4) ;
                NOINSET DATE TIME KEYBOARD 2007

ACTIVATE WINDOW oWnd ;  // MAXIMIZED ;
            ON INIT  (oTimer:Activate(), Client(), InfStatus()) ;
            VALID    (oTimer:Deactivate(), oTimer:End(), .T.)

if oSocket <> nil

    oSocket:Close()
    oSocket:End()

end
Close all
SET RESOURCES TO
ResAllFree()  
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Quit command

Post by Silvio.Falconi »

Exactly I use a timer to create a demo application and when the timer is finished a copyright dialog appears and after the program it should exit but it still remains in the task manager, on memory

IF ldemo

DEFINE TIMER ::oOutLic INTERVAL 20000 OF ::oWndMain ;
ACTION ( ::nTimeLic ++, if ( ::nTimeLic == 4, Demo_dialog(), ))
ACTIVATE TIMER ::oOutLic

Endif


Demo_dialog is a simply dialog with the quit
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Quit command

Post by dutch »

Dear Silvio,

I have problem with oTimer and oSocket that still running in the memory or task manager after quit the program. I don't know what is wrong in my procedure step.

This is my some part of my program that call oSocket and oTimer. I'm not quite sure where is the problem step of :Activate(), :End() of both.

Code: Select all

*-----------------*
Function Main
.....
DEFINE WINDOW oWnd TITLE 'EZHSC Interface ' FROM 0, 0 TO 750, 900 PIXEL ;
         MENU BuildMenu() MDI ;
         ICON oIcon

        DEFINE TIMER oTimer OF oWnd; 
                         INTERVAL nLoop ; 
                         ACTION if(lRun,MainLoop(),)

ACTIVATE WINDOW oWnd ; 
            ON INIT  (oTimer:Activate(), Client(), InfStatus()) ;
            VALID    (oTimer:End(), .T.)  

    oSocket:Close()
    oSocket:End()
return nil

*--------------------*
function Client()

oSocket := TSocket():New( nPort )

oSocket:bRead    := { | oSocket | OnRead( oSocket ) }  // oSocket:GetData() }  // 

oSocket:nTimeOut := 5
// Never use a MsgInfo() here because it hangs Windows!!!
oSocket:bConnect := { || OnConnected() }

oSocket:bClose   := { || ( lConnect := .F., oSay7:SetText( "OFF" ), oSay7:Refresh(), MsgWait( "Server has closed!",, 3 )) } 

oSocket:Connect( cSvrIP ) // use the server IP address here

return nil
Thank for your opinion
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
dtussman
Posts: 78
Joined: Sat Jun 06, 2015 6:57 pm

Re: Quit command

Post by dtussman »

what does postquitmessage(0) do? I tried using that followed by a Quit command and it works fine under windows 7 but under XP it generates an error message. If you leave off the Quit command it works fine but is that ok?
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Quit command

Post by Antonio Linares »

David,

https://msdn.microsoft.com/es-es/librar ... s.85).aspx

Normally there is no need to call Quit() neither PostQuitMessage() using FWH, as FWH does it automatically
regards, saludos

Antonio Linares
www.fivetechsoft.com
dtussman
Posts: 78
Joined: Sat Jun 06, 2015 6:57 pm

Re: Quit command

Post by dtussman »

Gracias Antonio y feliz Navidad
Post Reply