PARAMETERS cBdd, cHost


SET TALK off
SET STATUS BAR OFF
SET SYSMENU off
SET DELETED on
SET CONFIRM OFF
SET NOTIFY off
SET SAFETY off
SET CENTURY ON
SET DATE TO DMY
SET FIXED OFF
SET DECIMALS TO 6
SET ESCAPE off
SET PATH TO proj,json,classes, form,prg,class


*** Clases para el manejo de Web
*!*	SET PATH TO ".\classes" ADDITIVE
*!*	SET PROCEDURE TO wwHTTP ADDITIVE   
*!*	SET PROCEDURE TO wwAPI ADDITIVE
*!*	SET PROCEDURE TO wwFTP ADDITIVE
*!*	SET PROCEDURE TO wwUtils ADDITIVE
*!*	SET PROCEDURE TO classes\wwEval ADDITIVE
*SET PROCEDURE TO source\compelec additive

*On Shutdown CloseApplication()


_screen.Visible = .t.
_screen.Caption = 'GServ: Ghost-Server Ventas Moviles'

_screen.Icon = 'images/ico/ghost_flat.ICO'
_screen.AutoCenter = .t.
_screen.Closable = .t.
_screen.Height = 520
_screen.Width = 700
_screen.ControlBox = .T.
_SCREEn.BorderStyle = 2
_screen.AutoCenter= .T.
_screen.Show



DECLARE Sleep IN Win32API INTEGER   

*DO classes\wwapi.prg

DO app.prg WITH cBdd

oApp.lgServ			 = .T.
oApp.loadGhost()
oApp.setGhost(.T.)
oApp.host = oApp.hostjson

IF oApp.lGhostLocal
	oApp.host = 'localhost'+IIF(!EMPTY(oApp.portjson),':'+oApp.portjson,'')
ENDIF

IF !EMPTY(cHost)
	oApp.host = cHost
ENDIF 


*WAIT WINDOW oApp.host

DO json\js.prg WITH cbdd

DO initdb.prg WITH 1



Do Form gserv
Read Events

RELEASE oHTTP, oIP
If Type("_vfp.BindWindowsEventsProxy")<>"U"
	_vfp.BindWindowsEventsProxy = Null
ENDIF

Set Library To

_SCREEN.WindowState = 2
CLEAR ALL
CLOSE ALL
SET SYSMENU TO defa

On Shutdown
Clear Events
If _vfp.StartMode > 0
	QUIT
ENDIF



