FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Quit command
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Quit command
Posted: Wed Dec 13, 2017 09:47 AM
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 (fw): Select all Collapse
 
IF oDlgAuth:nresult == IDOK
      FreeResources()
       sysrefresh()
       DbcloseAll()
       hb_gcall(.t.)
       release all
       clear memory
       postquitMessage(0)
     __Quit()
   ENDIF
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Quit command
Posted: Wed Dec 13, 2017 11:25 AM

These two lines

PostQuitMessage( 0 )
QUIT

should be enough.
Please check again.

Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Quit command
Posted: Wed Dec 13, 2017 11:44 AM

on win10 seem run ok
this afternoon I try it on win7

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 90
Joined: Wed Nov 07, 2007 08:56 AM
Re: Quit command
Posted: Wed Dec 13, 2017 02:15 PM
QUIT is the same as __QUIT()

Code (fw): Select all Collapse
#command QUIT                    => __Quit()
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Quit command
Posted: Wed Dec 13, 2017 02:25 PM
Code (fw): Select all Collapse
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 - Phone: +55(11)95150-7341
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: Quit command
Posted: Thu Dec 14, 2017 05:45 AM
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 (fw): Select all Collapse
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 2304 / 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)
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Quit command
Posted: Thu Dec 14, 2017 10:17 AM

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

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: Quit command
Posted: Mon Dec 18, 2017 05:04 AM
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 (fw): Select all Collapse
*-----------------*
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 2304 / 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)
Posts: 102
Joined: Sat Jun 06, 2015 06:57 PM
Re: Quit command
Posted: Wed Dec 20, 2017 10:04 PM

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?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Quit command
Posted: Thu Dec 21, 2017 09:15 AM
David,

https://msdn.microsoft.com/es-es/library/windows/desktop/ms644945(v=vs.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
Posts: 102
Joined: Sat Jun 06, 2015 06:57 PM
Re: Quit command
Posted: Fri Dec 22, 2017 05:43 PM

Gracias Antonio y feliz Navidad

Continue the discussion