Page 1 of 1
How to do chat and file transfer software using fivewin ?
Posted: Thu Aug 21, 2014 9:38 am
by shahir.fivewin
Dear all
Is anybody's knows about how to build chat and file transfer application or any concept for this ?
I would like to build this type of application for local network. Please share with me if anybody's have an idea about this.
Thanking You
Muhammed Shahir
Re: How to do chat and file transfer software using fivewin ?
Posted: Fri Aug 22, 2014 12:53 am
by Antonio Linares
Muhammed,
Its a very simple concept:
Just browse a shared DBF that has a field of 80 chars or so. You refresh the browse every x secs. If one of the users write on it, all the others see it
A shared file will be just a line in the chat pointing to a shared donwload location visible from such chat.
Re: How to do chat and file transfer software using fivewin ?
Posted: Fri Aug 22, 2014 11:17 am
by shahir.fivewin
Dear sir,
I would like use MySQL Server for built chat application. How can i refresh xbrowse each time and fetch data from MySQL ?
Re: How to do chat and file transfer software using fivewin ?
Posted: Sat Aug 23, 2014 4:19 am
by ShumingWang
DEFINE TIMER otimer ;
INTERVAL 14000 ;
ACTION Msg() ;
OF oWnd
FUNCTION Msg(lok)
local odb1,odlg
private obrow
DEFAULT lok:=.f.
odb1:=oServer:Query("select receiver from message where receiver='"+username1+"' and lread<>'Y'";
+" union all select receiver from message where receiver='' and lread<>'Y'";
+"")
if odb1:LASTREC()>0 .or. lok
otimer:DeActivate()
if odb1:LASTREC()>0
msginfo2("您有"+cvaltochar(odb1:LASTREC())+"条新的短消息!","提示")
endif
odb1:end()
odb1:=oServer:Query("select * from message where receiver='"+username1+"' ";
+" union all select * from message where receiver=''";
+" order by dateline DESC")
DEFINE DIALOG odlg RESOURCE "msg1" TITLE "即时通信系统" FONT ofont14
obrow := TXBrowse():New( odlg )
obrow:SetMySQL(@odb1)
obrow:nMarqueeStyle:=4
obrow:bSkip:=obrow:bSkipper
oCol := obrow:AddCol()
oCol:bStrData := {||odb1:sender}
oCol:cHeader := "发送人"
oCol := obrow:AddCol()
oCol:bStrData := {||odb1:dateline}
oCol:cHeader := "发送时间"
oCol := obrow:AddCol()
oCol:bStrData := {||odb1:lread}
oCol:cHeader := "已读"
obrow:CreateFromResource(201)
REDEFINE SBUTTON ID 101 OF odlg PROMPT "创建" xp ACTION NewMsg()
REDEFINE SBUTTON ID 102 OF odlg PROMPT "查看" xp ACTION ViewMsg(@odb1)
REDEFINE SBUTTON ID 103 OF odlg PROMPT "删除" xp ACTION (oserver:query("delete from message where messageid="+cvaltochar(odb1:messageid)+if(username1=="SUPER ",""," and receiver='"+username1+"'")),odb1:refresh(),obrow:refresh(.t.))
REDEFINE SBUTTON ID 104 OF odlg PROMPT "刷新" xp ACTION (odb1:refresh(),obrow:refresh())
REDEFINE SBUTTON ID 105 OF odlg PROMPT "退出" xp ACTION odlg:end()
ACTIVATE DIALOG odlg CENTER on INIT odlg:autoresize()
otimer:ACTIVATE()
endif
odb1:end()
return
FUNCTION NewMsg(receiver)
local odlg,content:=SPACE(200)
DEFAULT receiver:=SPACE(8)
DEFINE DIALOG odlg RESOURCE "msg3" TITLE "新建短消息" FONT ofont14
REDEFINE GET receiver ID 101 OF odlg PICTURE "@!"
REDEFINE GET content ID 201 OF odlg
REDEFINE SBUTTON ID 102 OF odlg PROMPT "发送" xp ACTION (oServer:Query("insert into message (receiver,sender,dateline,content) values ('"+cvaltochar(receiver)+"','"+username1+"',now(),'"+TranMsg(content)+"')"),odlg:end())
REDEFINE SBUTTON ID 103 OF odlg PROMPT "退出" xp ACTION odlg:end()
REDEFINE SAY PROMPT "收件人" ID 901 OF odlg
ACTIVATE DIALOG odlg CENTER on INIT odlg:autoresize()
return
FUNCTION ViewMsg(odb1)
local odlg
oServer:Query("update message set lread='Y' where messageid="+cvaltochar(odb1:messageid))
DEFINE DIALOG odlg RESOURCE "msg2" TITLE "查看短消息" FONT ofont14
REDEFINE GET odb1:sender ID 101 OF odlg WHEN .f.
REDEFINE GET odb1:dateline ID 102 OF odlg WHEN .f.
REDEFINE GET odb1:content ID 201 OF odlg READONLY MEMO
REDEFINE SAY PROMPT "发件人:" ID 901 OF odlg
REDEFINE SAY PROMPT "时间" ID 902 OF odlg
REDEFINE SBUTTON ID 103 OF odlg PROMPT "回复" xp ACTION (RepMsg(odb1:sender),odlg:end())
REDEFINE SBUTTON ID 104 OF odlg PROMPT "删除" xp ACTION (oserver:query("delete from message where messageid="+cvaltochar(odb1:messageid)+if(username1=="SUPER ",""," and receiver='"+username1+"'")),odb1:refresh(),obrow:refresh(.t.),odlg:end())
REDEFINE SBUTTON ID 105 OF odlg PROMPT "退出" xp ACTION odlg:end()
ACTIVATE DIALOG odlg CENTER on INIT odlg:autoresize()
return
FUNCTION RepMsg(receiver)
local odlg,content:=space(200)
DEFINE DIALOG odlg RESOURCE "msg3" TITLE "回复短消息" FONT ofont14
REDEFINE GET receiver ID 101 OF odlg WHEN .f.
REDEFINE GET content ID 201 OF odlg
REDEFINE SAY PROMPT "收件人" ID 901 OF odlg
REDEFINE SBUTTON ID 102 OF odlg PROMPT "发出" xp ACTION (oServer:Query("insert into message (receiver,sender,dateline,content) values ('"+cvaltochar(receiver)+"','"+username1+"',now(),'"+TranMsg(content)+"')"),odlg:end())
REDEFINE SBUTTON ID 103 OF odlg PROMPT "退出" xp ACTION odlg:end()
ACTIVATE DIALOG odlg CENTER on INIT odlg:autoresize()
return
Re: How to do chat and file transfer software using fivewin ?
Posted: Sat Aug 23, 2014 9:59 am
by shahir.fivewin
Thanks