Quit command

Quit command

Postby Silvio.Falconi » Wed Dec 13, 2017 9: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: Select all  Expand view

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 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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Quit command

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Quit command

Postby Silvio.Falconi » 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 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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Quit command

Postby Patrizio » Wed Dec 13, 2017 2:15 pm

QUIT is the same as __QUIT()

Code: Select all  Expand view
#command QUIT                    => __Quit()
Patrizio
 
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy

Re: Quit command

Postby karinha » Wed Dec 13, 2017 2:25 pm

Code: Select all  Expand view

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
User avatar
karinha
 
Posts: 7813
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Quit command

Postby dutch » Thu Dec 14, 2017 5: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: Select all  Expand view
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
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Quit command

Postby Silvio.Falconi » 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 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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Quit command

Postby dutch » Mon Dec 18, 2017 5: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: Select all  Expand view
*-----------------*
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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Quit command

Postby dtussman » 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?
dtussman
 
Posts: 97
Joined: Sat Jun 06, 2015 6:57 pm

Re: Quit command

Postby Antonio Linares » Thu Dec 21, 2017 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Quit command

Postby dtussman » Fri Dec 22, 2017 5:43 pm

Gracias Antonio y feliz Navidad
dtussman
 
Posts: 97
Joined: Sat Jun 06, 2015 6:57 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 89 guests