viewRadio_th线程函数在form外生命全局变量、函数内相应的局部变量可以接收全局变量的赋值进行操作、query等可以自行创建进行查询、这样结果不会改变。

//下面是后台发送字幕的线程函数应用。

……

var
ldate,ldatetime:string;
lHandle:thandle;
dloopThreadID:dword;
message_form: Tmessage_form;
function viewRadio_th(P:pointer):Longint;stdcall; implementation
uses commonDM, ubox_c, common_u, loginform; …… //调用线程 lHandle := CreateThread(nil,0,@viewRadio_th,nil,0,dloopThreadID); //线程函数 function viewRadio_th(P:pointer):Longint;stdcall; var lquery,lnumquery:Toraquery;
I,j: Integer;
th_date,th_datetime:string;
th_handle:thandle;
th_loopThreadID:dword;
maxnum,boxid,boxip:string;
F:Textfile;
begin
th_date:=ldate;
th_datetime:=ldatetime;
th_handle:=lhandle;
th_loopThreadID:=dloopThreadID;
lquery:=Toraquery.Create(nil);
lnumquery:=toraquery.Create(nil);
lquery.FetchAll:=true;
lnumquery.Session:=common_dm.common_session;
lquery.Session:=common_dm.common_session;
with lnumquery do
begin
close;
sql.Clear;
sql.Add('select max(promotesalesplaynumber) maxnum from promotesales_t where PROMOTESALESTYPE=''?¤??'' and '''+
th_date+' ''||PROMOTESALESPLAYTIME='''+th_datetime+'''');
open;
end; // with
if lnumquery.RecordCount<>0 then
maxnum:=lnumquery['maxnum'];
with lquery do
begin
close;
sql.Clear;
sql.Add('select * from promotesales_t where PROMOTESALESTYPE=''?¤??'' and '''+
th_date+' ''||PROMOTESALESPLAYTIME='''+th_datetime+'''');
open;
end; // with
for I := 1 to strtoint(maxnum) do // Iterate
begin
lquery.First;
if i<>1 then
sleep(60000);
for j := 0 to lquery.RecordCount - 1 do // Iterate
begin
if strtoint(lquery['promotesalesplaynumber'])>=i then
begin
boxid:=lquery['promoteboxid'];
with lnumquery do
begin
Close;
SQL.Clear;
SQL.Add('select * from BOX_T where BOXID='''+boxid+'''');
Open;
end; // with
boxip:=lnumquery['boxip'];
if fileExists(common_u.fileaddress(boxip,'radioroot')+'.tit') then
Deletefile(common_u.fileaddress(boxip,'radioroot')+'.tit');
AssignFile(F, common_u.fileaddress(boxip,'radioroot')+'.tit'); {??????????±??? F ????}
ReWrite(F);
Writeln(F, '[Parameter]'+#13+'Delay=0'+#13+'IntoDelay=0'+#13+#13+'[TextAdOsd]'+
#13+'PlayMode=RIGHT_IN_LEFT_OUT'+#13+'Type=Text'+#13+'Font=????'+#13+'FontSize=40'+#13+'LoopTime=1'+#13+'Speed=5'
+#13+'Delay=0'+#13+'Time=0'+#13+'ForegroundColor=255 255 0'+#13+'BackgroundColor=0 0 0'+#13+'UseShadow=y'+#13+'ShadowColor=255 0 0'
+#13+'ShadowDelta=1 1'+#13+'cmd=first'+#13+'Text='+lquery['PROMOTESALESCONTENT']);
Closefile(F); {??±????? F}
end;
lquery.Next;
end; // for end; // for
lquery.Free;
lnumquery.Free;
if th_handle<>0 then
TerminateThread(th_handle,th_loopThreadID);
end;

  

最新文章

  1. C#学习笔记-icon托盘图标的简单知识
  2. pthread 学习系列 case2-- pthread_mutex_t
  3. JAVA之网页截屏
  4. RecyclerView 结合 CardView 使用(二)
  5. Div+Css的初步运用
  6. paip.提升用户体验---c++ qt 取消gcc编译的警告信息.txt
  7. 《那些事之Log4j》什么是log4j?【专题一】
  8. Core Data (二)备
  9. (转)生产者/消费者问题的多种Java实现方式 (待整理)
  10. 关于IPFS的热门问题
  11. oracle 将一个表复制到另外一个表里 .
  12. vue中复选框全选与反选
  13. Asp.net Core Mvc EF- Migrations使用
  14. DBus send byte array over gdbus ----Send dbus data
  15. luogu4268 Directory Traversal (dfs)
  16. Clustered Shading架构实现步骤
  17. HDU 4315 阶梯博弈变形
  18. SQL表之间复制数据、选出随机几条数据、删除重复数据、取得自增长列等操作
  19. MySql C++调用库Connector/c++编译 和 接口封装【三】Connector/c++ 使用总结及封装
  20. Codeforces 722C(并查集 + 思维)

热门文章

  1. jquery autoComplete的使用代码一则
  2. Android开发SDK接入机智云,智能家居实现APP远程控制多设备
  3. 改动Androidproject的名称(非Eclipse重命名)
  4. iOS开发-发送邮件(E-mail)方法整理合集(共3种)
  5. linux如何手动释放linux内存
  6. 工作总结 &quot;2017年8月11日&quot; 转换为datatime
  7. Delphi获得与设置系统时间格式《转》
  8. java中ThreadLocalRandom类和Random类的使用
  9. HNU 13411 Reverse a Road II(最大流+BFS)经典
  10. PILE读书笔记_进程环境