Page 1 of 1

Quit command

Posted: Wed Dec 13, 2017 9:47 am
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

Re: Quit command

Posted: Wed Dec 13, 2017 11:25 am
by nageswaragunupudi
These two lines

PostQuitMessage( 0 )
QUIT

should be enough.
Please check again.

Re: Quit command

Posted: Wed Dec 13, 2017 11:44 am
by Silvio.Falconi
on win10 seem run ok
this afternoon I try it on win7

Re: Quit command

Posted: Wed Dec 13, 2017 2:15 pm
by Patrizio
QUIT is the same as __QUIT()

Code: Select all

#command QUIT                    => __Quit()

Re: Quit command

Posted: Wed Dec 13, 2017 2:25 pm
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
 

Re: Quit command

Posted: Thu Dec 14, 2017 5:45 am
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()  

Re: Quit command

Posted: Thu Dec 14, 2017 10:17 am
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

Re: Quit command

Posted: Mon Dec 18, 2017 5:04 am
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

Re: Quit command

Posted: Wed Dec 20, 2017 10:04 pm
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?

Re: Quit command

Posted: Thu Dec 21, 2017 9:15 am
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

Re: Quit command

Posted: Fri Dec 22, 2017 5:43 pm
by dtussman
Gracias Antonio y feliz Navidad