Window y Dialog

Window y Dialog

Postby softruz » Tue Nov 03, 2009 6:54 pm

Muy buenas foro, tengo un programa que me muestra un dialogo, pero le he añadido una funcion que se tiene que conectar por socket, entonces tuve que crear una windows para los sockets, cuando tengo el valor necesario, cierro la window y los sockets, y cuando voy a cargar el dialogo no se carga, se que es por la window, pero no se como solucionarlo, aqui teneis mas o menos el código:

SI COMENTO LA LINEA cIP:=GetPublicIP() me carga el dialogo.

function main()
local cIP
cIP:=GetPublicIP()
define dialog oDlg resource "CDILAUNCHER"
...
...
activate dialog oDlg center

return

function GetPublicIP(cServer,cWeb)
local oWnd,cIP:="",nI:=0,nF:=0
public cTextWeb:=""
default cServer:="xxx",cWeb:="xxx"
define window oWnd title "GetPublicIP" from -100, -100 to -100, -100
activate window oWnd on init (GetIPWeb(cServer,cWeb,@oWnd))
cIP:=cTextWeb
release cTextWeb
if !empty(cIP)
nI:=at('<b>',cIP)
nF:=at('</b>',cIP)
if nI<>0 .and. nF<>0
cIP:=substr(cIP,nI+3,nF-nI-3)
end if
end if
return cIP
static function GetIPWeb(cServer,cWeb,oWnd)
local oWebClient
oWebClient:=TWebClient():New()
oWebClient:Connect(cServer)
oWebClient:bOnRead = { |cData| (cTextWeb+=cData,oWnd:end()) }
oWebClient:oSocket:SendData( "GET "+cWeb+" HTTP/1.0" + CRLF +"Host: "+cServer+ CRLF +CRLF )
return

Un Saludo.
softruz
 
Posts: 485
Joined: Fri Feb 09, 2007 10:34 am

Re: Window y Dialog

Postby Antonio Linares » Tue Nov 03, 2009 7:34 pm

Juan,

La primera ventana ó diálogo que creas en FiveWin se establece como ventana principal, de tal forma, que al cerrarse, FiveWin entiende que se va a terminar la aplicación, y se inicia un proceso de cierre automatico.

Como quieres que el diálogo sea tu "ventana" principal, prueba a hacerlo asi:
Code: Select all  Expand view

DEFINE DIALOG oDlg

ACTIVATE DIALOG oDlg ON INIT ( cIP:=GetPublicIP() )
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41390
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 65 guests