我来一个开源的VOD系统,已在本地稳定运行多年的。(1分)

  • 主题发起人 电猛LimIt
  • 开始时间

电猛LimIt

Unregistered / Unconfirmed
GUEST, unregistred user!
program NS3vod_mouse_2disy;


uses
Forms,
windows,
Unit1 in 'UNIT1.PAS' {nsktv},
Unit_dm in 'Unit_dm.pas' {dm: TDataModule},
Unit5 in 'Unit5.pas' {sple},
Unit6 in 'Unit6.pas' {aboutme_f},
my_common in 'my_common.pas' {Unit6},
magbox in 'magbox.pas' {magfrm},
resize_thread in 'resize_thread.pas',
iniapp in 'iniapp.pas',
uresize_thread2 in 'uresize_thread2.pas',
timepro in 'timepro.pas',
do
WN in 'DOWN.pas' {dowm_f},
FMPdefs in 'FMPdefs.pas',
fmpfplay in 'fmpfplay.pas',
md5 in 'md5.pas',
errform in 'errform.pas' {errform_f};

{$R *.res}
const classname='nsktv';
{声明为主窗体的类名}
var
lTime :TDateTime;
H:THandle;
{变量}
begin

H:=Createmutex(nil,false,classname);
If getlasterror=ERROR_ALREADY_EXISTS then

begin

CloseHandle(H);
if messagebox(0,'本服务只支持一个实例运行,是否开启第二个实例','辉煌触摸屏版',mb_yesno+mb_systemmodal)=idno then

begin

application.Terminate ;
{退出程序}
exit;
end;

end;

sple:=Tsple.Create(sple);
sple.Show;
sple.Update;
lTime:=GetTickCount;
Application.Initialize();
Application.Title := '明日VOD视频点播系统';
Application.CreateForm(Tdm, dm);
Application.CreateForm(Tnsktv, nsktv);
application.ProcessMessages;
while((GetTickCount-lTime) / 100 <19)do
application.processMessages ;
;
sple.hide;
sple.free;

Application.Run;
end.





unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,mmsystem,
Dialogs, StdCtrls, jpeg, ExtCtrls, winsock,shellapi,
NMUDP,nb30,StrUtils, ScktComp,IniFiles,
my_common, TFlatHintUnit, IdRawClient, IdRawBase,
IdBaseComponent, IdComponent, IdIcmpClient,
TFlatListBoxUnit, GlowLabel, yupack;

type
PIPOptionInformation = ^TIPOptionInformation;
TIPOptionInformation = packed record
TTL: Byte;
TOS: Byte;
Flags: Byte;
OptionsSize: Byte;
OptionsData: PChar;
end;

PIcmpEchoReply = ^TIcmpEchoReply;
TIcmpEchoReply = packed record
Address: DWORD;
Status: DWORD;
RTT: DWORD;
DataSize: Word;
Reserved: Word;
Data: Pointer;
Options: TIPOptionInformation;
end;

TIcmpCreateFile = function: THandle;
stdcall;
TIcmpCloseHandle = function(IcmpHandle: THandle): Boolean;
stdcall;
TIcmpSendEcho = function(IcmpHandle:THandle;
DestinationAddress: DWORD;
RequestData: Pointer;
RequestSize: Word;
RequestOptions: PIPOptionInformation;
ReplyBuffer: Pointer;
ReplySize: DWord;
Timeout: DWord
):DWord;stdcall;
type
Tnsktv = class(TForm)
p00: TPanel;
p11: TPanel;
p21: TPanel;
p34: TPanel;
p90: TPanel;
p91: TPanel;


p0_i1: TImage;
p34_i1:TImage;
p21_i1:TImage;
p11_i1:TImage;
Timer2: TTimer;
Timer3: TTimer;
udpc: TNMUDP;
p90_i1: TImage;
py01: TImage;
P93: TPanel;
P93_i1: TImage;
p36: TPanel;
p36_i1: TImage;
p91_i0: TImage;
p91_l5: TYuSoftLabel;
p91_l1: TYuSoftLabel;
p91_l3: TYuSoftLabel;
p91_l6: TYuSoftLabel;
p91_l2: TYuSoftLabel;
p91_l4: TYuSoftLabel;
ping_time: TTimer;
p90_lp1: TLabel;
p91_lp1: TLabel;
FlatHint1: TFlatHint;
i12: TImage;
p34_l0: TLabel;
p36_l0: TLabel;
p91_l9: TLabel;
p91_l0: TLabel;
Timer6: TTimer;
p0_l5: TImage;
p0_l3: TImage;
p0_l2: TImage;
p0_l7: TImage;
p0_l8: TImage;
p0_l4: TImage;
p0_l1: TImage;
Image12: TImage;
Image13: TImage;
man_play: TImage;
woman_play: TImage;
arrow2: TImage;
p11_l1: TImage;
p11_l2: TImage;
p11_l3: TImage;
p11_l4: TImage;
p11_l5: TImage;
p11_l6: TImage;
p11_l7: TImage;
p11_l8: TImage;
p11_l9: TImage;
p11_lA: TImage;
uppage90: TImage;
updown90: TImage;
k0B: TImage;
k09: TImage;
k08: TImage;
k07: TImage;
k06: TImage;
k05: TImage;
k04: TImage;
k03: TImage;
k02: TImage;
k01: TImage;
Image19: TImage;
p34_l1: TImage;
p34_l2: TImage;
p34_l3: TImage;
p34_l4: TImage;
P93_l1: TImage;
P93_l4: TImage;
P93_l2: TImage;
P93_l3: TImage;
Image27: TImage;
Image31: TImage;
word_a: TImage;
word_b: TImage;
word_c: TImage;
word_d: TImage;
word_e: TImage;
word_f: TImage;
word_g: TImage;
word_h: TImage;
word_i: TImage;
word_j: TImage;
word_k: TImage;
word_l: TImage;
word_m: TImage;
word_n: TImage;
word_p: TImage;
word_o: TImage;
word_r: TImage;
word_q: TImage;
word_t: TImage;
word_s: TImage;
word_v: TImage;
word_u: TImage;
word_x: TImage;
word_w: TImage;
word_z: TImage;
word_y: TImage;
return91: TImage;
p36_l1: TImage;
p36_l3: TImage;
p36_l4: TImage;
p36_l5: TImage;
Timer1: TTimer;
p92_E: TImage;
p92_F: TImage;
backgrou: TTimer;
all_player: TImage;
arrow3: TImage;
P93_l7: TImage;
P93_l8: TImage;
P93_l9: TImage;
P93_l0: TImage;
arrow4: TImage;
Timer4: TTimer;
p91_i1: TImage;
p91_i2: TImage;
p91_i3: TImage;
p91_i6: TImage;
p91_i5: TImage;
p91_i4: TImage;
p90_l1: TLabel;
p90_l2: TLabel;
p90_l4: TLabel;
p90_l3: TLabel;
p90_l6: TLabel;
p90_l5: TLabel;
p22: TPanel;
p22_i1: TImage;
p21_l0: TImage;
p21_l1: TImage;
p21_l9: TImage;
p21_l8: TImage;
p21_l2: TImage;
p21_l7: TImage;
p21_l6: TImage;
p21_l3: TImage;
p21_l5: TImage;
p21_l4: TImage;
p0_l9: TImage;
p24: TPanel;
p24_i1: TImage;
p24_l1: TYuSoftLabel;
p24_l2: TYuSoftLabel;
p24_l3: TYuSoftLabel;
p24_l4: TYuSoftLabel;
p24_l5: TYuSoftLabel;
p24_l6: TYuSoftLabel;
p24_l7: TYuSoftLabel;
p24_l8: TYuSoftLabel;
p24_l9: TYuSoftLabel;
p24_l10: TYuSoftLabel;
p24_l11: TYuSoftLabel;
p24_l12: TYuSoftLabel;
p24_l13: TYuSoftLabel;
p24_l14: TYuSoftLabel;
p24_l15: TYuSoftLabel;
arrow5: TImage;
p0_l10: TImage;
p24_9: TImage;
p24_0: TImage;
p0_l6: TImage;
arrow6: TImage;
p24_iA: TImage;
p24_iB: TImage;
p24_iC: TImage;
p24_iD: TImage;
p24_iE: TImage;
p24_iF: TImage;
p24_iG: TImage;
p24_iH: TImage;
p24_iI: TImage;
p24_iJ: TImage;
p24_iK: TImage;
p24_iL: TImage;
p24_iM: TImage;
p24_iN: TImage;
p24_iP: TImage;
p24_iO: TImage;
p24_iR: TImage;
p24_iQ: TImage;
p24_iT: TImage;
p24_iS: TImage;
p24_iV: TImage;
p24_iU: TImage;
p24_iX: TImage;
p24_iW: TImage;
p24_iZ: TImage;
p24_iY: TImage;
p24_i: TImage;
nextplay_0: TLabel;
nowplay_0: TLabel;
nextplay_11: TLabel;
nowplay_11: TLabel;
nextplay_21: TLabel;
nowplay_21: TLabel;
nowplay_22: TLabel;
nextplay_22: TLabel;
nowplay_24: TLabel;
nextplay_24: TLabel;
nextplay_34: TLabel;
nowplay_34: TLabel;

nextplay_36: TLabel;
nowplay_36: TLabel;
nextplay_90: TLabel;
nowplay_90: TLabel;
nextplay_91: TLabel;
nowplay_91: TLabel;
nextplay_93: TLabel;
nowplay_93: TLabel;
Image29: TImage;
Image30: TImage;
Image32: TImage;
Image35: TImage;
Image38: TImage;
Image39: TImage;
Image40: TImage;
Image42: TImage;
Image43: TImage;
Image44: TImage;
Image45: TImage;
song_w_a: TImage;
song_w_b: TImage;
song_w_c: TImage;
song_w_d: TImage;
song_w_e: TImage;
song_w_f: TImage;
song_w_g: TImage;
song_w_h: TImage;
song_w_i: TImage;
song_w_j: TImage;
song_w_k: TImage;
song_w_l: TImage;
song_w_m: TImage;
song_w_n: TImage;
song_w_p: TImage;
song_w_o: TImage;
song_w_r: TImage;
song_w_q: TImage;
song_w_t: TImage;
song_w_s: TImage;
song_w_v: TImage;
song_w_u: TImage;
song_w_x: TImage;
song_w_w: TImage;
song_w_z: TImage;
song_w_y: TImage;
p35: TPanel;
p35_i1: TImage;
p35_l8: TImage;
p35_l9: TImage;
p35_l5: TImage;
p35_l4: TImage;
p35_l3: TImage;
p35_l2: TImage;
p35_l1: TImage;
p35_l0: TImage;
p35_l7: TImage;
p35_l6: TImage;
nextplay_35: TLabel;
nowplay_35: TLabel;
my_enter_py: TLabel;
p35_lA: TImage;
p35_lB: TImage;
Edit1: TEdit;
p35_lD: TImage;
Image146: TImage;
showmypos: TPanel;
Image17: TImage;
Image24: TImage;
Image41: TImage;
Image58: TImage;
Image59: TImage;
Image60: TImage;
Image61: TImage;
Image62: TImage;
Image63: TImage;
Image64: TImage;
Image65: TImage;
Image66: TImage;
Image34: TImage;
Image67: TImage;
Image68: TImage;
Image69: TImage;
Image106: TImage;
Image107: TImage;
Image108: TImage;
Image109: TImage;
Image110: TImage;
Image111: TImage;
Image112: TImage;
Image113: TImage;
Image14: TImage;
Image82: TImage;
Image83: TImage;
Image84: TImage;
Image85: TImage;
Image86: TImage;
Image87: TImage;
Image88: TImage;
Image89: TImage;
Image90: TImage;
Image91: TImage;
Image92: TImage;
Image93: TImage;
Image114: TImage;
image345: TImage;
Image116: TImage;
Image117: TImage;
Image118: TImage;
Image119: TImage;
Image120: TImage;
Image121: TImage;
Image122: TImage;
Image123: TImage;
Image124: TImage;
returnme: TImage;
Image126: TImage;
Image127: TImage;
Image128: TImage;
Image129: TImage;
Image132: TImage;
Image133: TImage;
Image134: TImage;
Image135: TImage;
Image136: TImage;
Image137: TImage;
Image138: TImage;
p24_label: TLabel;
Image139: TImage;
Image140: TImage;
Image141: TImage;
Image142: TImage;
Image143: TImage;
Image144: TImage;
Image145: TImage;
Image147: TImage;
Image148: TImage;
Image149: TImage;
Image150: TImage;
Image151: TImage;
Image2: TImage;
Image3: TImage;
Image4: TImage;
Image5: TImage;
Image6: TImage;
Image7: TImage;
Image8: TImage;
Image9: TImage;
Image10: TImage;
Image11: TImage;
Image23: TImage;
Image28: TImage;
Image25: TImage;
Image94: TImage;
Image95: TImage;
Image96: TImage;
Image97: TImage;
Image98: TImage;
Image99: TImage;
Image100: TImage;
Image101: TImage;
Image102: TImage;
Image103: TImage;
Image104: TImage;
Image21: TImage;
Image46: TImage;
Image47: TImage;
Image48: TImage;
Image49: TImage;
Image50: TImage;
Image51: TImage;
Image52: TImage;
Image53: TImage;
Image54: TImage;
Image55: TImage;
Image56: TImage;
Image57: TImage;
Image70: TImage;
Image71: TImage;
Image72: TImage;
Image73: TImage;
Image74: TImage;
Image75: TImage;
Image76: TImage;
Image77: TImage;
Image78: TImage;
Image79: TImage;
Image80: TImage;
myselectpy: TLabel;
_1_1: TImage;
_2_1: TImage;
_3_1: TImage;
_1_2: TImage;
_2_2: TImage;
_3_2: TImage;
_1_3: TImage;
_2_3: TImage;
_3_3: TImage;
_1_4: TImage;
_2_4: TImage;
_3_4: TImage;
_1_5: TImage;
_2_5: TImage;
_3_5: TImage;
_1_6: TImage;
_2_6: TImage;
_3_6: TImage;
_1_8: TImage;
_2_8: TImage;
_3_8: TImage;
_1_9: TImage;
_2_9: TImage;
_3_9: TImage;
_1_0: TImage;
_2_0: TImage;
_3_0: TImage;
_1_11: TImage;
_2_11: TImage;
_3_11: TImage;
_1_12: TImage;
_2_12: TImage;
_3_12: TImage;
Image1: TImage;
Timer5: TTimer;
showmypos_pic: TImage;
myplaylist: TListBox;
p93_box1: TListBox;
sendudp: TNMUDP;
closeme_but: TImage;
procedure changskin(kind:integer);
procedure readplaylist;
//启动时读出上次未播放的节目
procedure saveplaylist;
//保存播放列有文件,用于断电时再恢复播放列表
procedure showmag(mag:string;kind:boolean);
procedure closeme;
procedure showok(how:integer);
//显示第HOW页
procedure enableok(how:integer;enabled_kind:boolean);
procedure allselect(Key: Word);
//全局按键,如加大音量等
procedure showplaystate(mag1:string;mag2:string);
procedure iniplaystate;
procedure clsmysonglist;
function sqlfirstword(fw:string):boolean;
//查询首字点歌
function DenCrypt(Str : string;
Key : string): string;
//加密字符串
procedure Clsmysql;
//清除MYSQL查询条件
function Keymap(Key: Word):word;
//转换实按键到虚按键
procedure clssong;
//清除歌曲列表
procedure clearfirstword;
procedure word_sql_player(sender:TObject);
procedure clsplayer();
//清除歌手列表
procedure returnone;
procedure inidb();
//向服务器请求数据库
procedure Checkok;
procedure showfirstword(how:integer);
//显示由HOW指定的首字点歌
procedure showsong(how:integer);
//显示由HOW指定的首字
procedure showplayer(how:integer);
//显示歌手的第 HOW 页到窗口上
procedure selectchang;
//更新已选歌曲显示
function sendmag(mag:string;ip:string):boolean;
//向服务器发送消息
// function ok(regcode:string):boolean;
function ifexit:boolean;
function sqlsong(ifshow:boolean):boolean;
//查找合乎mysql条件的歌曲
procedure numbsqlsong_1(sender:Tobject);
//根据字数来查询
procedure numbsqlsong(mykey:string);
function sqlplayer:boolean;
//查找合乎条件的歌手
function pressit(key:word):integer;
//返回在哪个面板上按键
procedure ininowplay;
//调整正在播放下首播放的位置
procedure enablepy(kind:boolean;visual:boolean);
procedure enablezs(kind:boolean);
procedure select0(key:word);
procedure select11(key:word);
procedure select21(key:word);
procedure select22(key:word);
procedure select24(key:word);
procedure select34(key:word);
procedure select35(key:word);
procedure select36(key:word);
procedure select90(key:word);
procedure select91(key:word);
procedure select92(key:word);
procedure select93(key:word);
procedure select102(key:word);
procedure p0_l1Click(Sender: TObject);
procedure p0_l2Click(Sender: TObject);
procedure FormKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
procedure FormCreate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
procedure p0_l3Click(Sender: TObject);
procedure p0_l4Click(Sender: TObject);
procedure udpcDataReceived(Sender: TComponent;
NumberBytes: Integer;FromIP: String;
Port: Integer);
procedure p0_l5Click(Sender: TObject);
procedure p35_l0Click(Sender: TObject);
procedure p0_l8Click(Sender: TObject);
procedure p91_l1Click(Sender: TObject);
procedure p91_l2Click(Sender: TObject);
procedure p91_l3Click(Sender: TObject);
procedure p91_l4Click(Sender: TObject);
procedure p91_l5Click(Sender: TObject);
procedure p91_l6Click(Sender: TObject);
procedure p91_l7Click(Sender: TObject);
procedure p91_l8Click(Sender: TObject);
procedure p91_l9Click(Sender: TObject);
procedure p91_l0Click(Sender: TObject);
procedure p92_l4Click(Sender: TObject);
procedure p92_l0Click(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure p92_l5Click(Sender: TObject);
procedure p92_l6Click(Sender: TObject);
procedure p21_l1Click(Sender: TObject);
procedure p21_l2Click(Sender: TObject);
procedure p21_l3Click(Sender: TObject);
procedure p21_l4Click(Sender: TObject);
procedure p21_l5Click(Sender: TObject);
procedure p21_l9Click(Sender: TObject);
procedure p21_l0Click(Sender: TObject);
procedure p21_l8Click(Sender: TObject);
procedure p21_l7Click(Sender: TObject);
procedure p21_l6Click(Sender: TObject);
procedure p22_l1Click(Sender: TObject);
procedure p22_l2Click(Sender: TObject);
procedure p22_l3Click(Sender: TObject);
procedure p22_l4Click(Sender: TObject);
procedure p22_l8Click(Sender: TObject);
procedure p22_l9Click(Sender: TObject);
procedure p22_l0Click(Sender: TObject);
procedure p22_l7Click(Sender: TObject);
procedure p22_l6Click(Sender: TObject);
procedure p22_l5Click(Sender: TObject);
procedure p92_l0MouseDown(Sender: TObject;
Button: TMouseButton;Shift: TShiftState;
X, Y: Integer);
procedure p11_l1Click(Sender: TObject);
procedure p11_l2Click(Sender: TObject);
procedure p11_l3Click(Sender: TObject);
procedure p11_l4Click(Sender: TObject);
procedure p11_l9Click(Sender: TObject);
procedure p11_l8Click(Sender: TObject);
procedure p11_l7Click(Sender: TObject);
procedure p11_l6Click(Sender: TObject);
procedure p11_l5Click(Sender: TObject);
procedure p34_l1Click(Sender: TObject);
procedure p34_l0Click(Sender: TObject);
procedure p34_l2Click(Sender: TObject);
procedure p34_l3Click(Sender: TObject);
procedure p34_l4Click(Sender: TObject);
procedure p35_l8Click(Sender: TObject);
procedure p35_l9Click(Sender: TObject);
procedure p90_l4Click(Sender: TObject);
procedure p90_l3Click(Sender: TObject);
procedure p90_l2Click(Sender: TObject);
procedure p90_l6Click(Sender: TObject);
procedure p90_l1Click(Sender: TObject);
procedure p90_l5Click(Sender: TObject);
procedure P93_l3Click(Sender: TObject);
procedure P93_l2Click(Sender: TObject);
procedure P93_l1Click(Sender: TObject);
procedure P93_l0Click(Sender: TObject);
procedure p36_l1Click(Sender: TObject);
procedure p36_l3Click(Sender: TObject);
procedure p36_l5Click(Sender: TObject);
procedure p36_l2Click(Sender: TObject);
procedure p36_l4Click(Sender: TObject);
procedure p36_l0Click(Sender: TObject);
procedure P93_l9Click(Sender: TObject);
procedure p0_l6Click(Sender: TObject);
procedure p0_l7Click(Sender: TObject);
procedure P93_l7Click(Sender: TObject);
procedure P93_l8Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure ping_timeTimer(Sender: TObject);
procedure p34_l5Click(Sender: TObject);
procedure p34_l6Click(Sender: TObject);
procedure p102_l1Click(Sender: TObject);
procedure p102_l2Click(Sender: TObject);
procedure p102_l3Click(Sender: TObject);
procedure p102_l5Click(Sender: TObject);
procedure p102_l9Click(Sender: TObject);
procedure p102_l4Click(Sender: TObject);
procedure p102_l6Click(Sender: TObject);
procedure P93_l4Click(Sender: TObject);
procedure Timer6Timer(Sender: TObject);
procedure p102_l8Click(Sender: TObject);
procedure p102_l7Click(Sender: TObject);
procedure puaseClick(Sender: TObject);
procedure p92_l2Click(Sender: TObject);
procedure p92_l1Click(Sender: TObject);
procedure p102_l10Click(Sender: TObject);
procedure replayClick(Sender: TObject);
procedure p102_l11Click(Sender: TObject);
procedure myplaylistClick(Sender: TObject);
procedure pre_songClick(Sender: TObject);
procedure del_songClick(Sender: TObject);
procedure man_playClick(Sender: TObject);
procedure woman_playClick(Sender: TObject);
procedure sql_word_song(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure p92_EClick(Sender: TObject);
procedure p92_FClick(Sender: TObject);
procedure Image27Click(Sender: TObject);
procedure Image23Click(Sender: TObject);
procedure p11_lAClick(Sender: TObject);
procedure backgrouTimer(Sender: TObject);
procedure return35Click(Sender: TObject);
procedure all_playerClick(Sender: TObject);
procedure return91Click(Sender: TObject);
procedure return90Click(Sender: TObject);
procedure Image10MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
procedure py_songlistKeyUp(Sender: TObject;
var Key: Word;
Shift: TShiftState);
procedure py_songlistKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
procedure py_songlistKeyPress(Sender: TObject;
var Key: Char);
procedure myplaylistKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
procedure Timer4Timer(Sender: TObject);
procedure p0_l9Click(Sender: TObject);
procedure p24_9Click(Sender: TObject);
procedure p24_0Click(Sender: TObject);
procedure p24_l1Click(Sender: TObject);
procedure Image2Click(Sender: TObject);
procedure p0_l10Click(Sender: TObject);
procedure p24_iAClick(Sender: TObject);
procedure showmypos_picClick(Sender: TObject);
procedure Image20Click(Sender: TObject);
procedure p35_lDClick(Sender: TObject);
procedure Image146Click(Sender: TObject);
procedure Image144Click(Sender: TObject);
procedure Image1DblClick(Sender: TObject);
procedure returnmeClick(Sender: TObject);
procedure Timer5Timer(Sender: TObject);
procedure FormMouseMove(Sender: TObject;
Shift: TShiftState;
X,
Y: Integer);
procedure p90_i1MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
procedure closeme_butMouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
private
mypos:tpoint;
hICMP: THANDLE;
IcmpCreateFile : TIcmpCreateFile;
IcmpCloseHandle: TIcmpCloseHandle;
IcmpSendEcho: TIcmpSendEcho;
sqlnow:boolean;
//是否正在查询
nowshowsongpage:integer;
//用于保存歌曲显示的页数
tdbsongpath:integer;
//声道选择
procedure iniquery;
//刚进系统时初始化查询,使以后查询速度更快
proceduredo
wnme;
procedure inimousemove;
procedure inistate(mykind:string;path:string);
procedure showstate(mykind:string;showit1:boolean);
function loadpict(myload:TImage;pictname:string):boolean;
//用于安全的装载图片

////////////////////////////////////////////////////////////////////////////////
procedure inibackgrouplaylist;
//初始化背景歌曲列表
function playbackgrouplaylist(myplaylist:tstringlist):string;
//找到要播放的背景音乐路径
////////////////////////////////////////////////////////////////////////////////
{ Private declarations }
public
////////////////////////////////////////////////////////////////////////////////
// //
// 新添加的加密干扰变量 //
// //
////////////////////////////////////////////////////////////////////////////////
love1,love2,love3,love4: dword;
mymaxdate: dword;
//本机的最大日期
////////////////////////////////////////////////////////////////////////////////
// //
// love1,love2,love3,love4为干扰变量 //
// //
// love1=1328930 love2=930335 love3=543661 love4=543623 //
// //
/////////////////////////////////////////////////////////////////////////////////
myexitpassword: string;
myexitmode: integer;

mydb: HModule;
// mydb:= loadlibrary(icmpDLL);用于动态安装DLL
ifshowdown: boolean;
//是否显示退出窗口
tbrightness,tcontrast,tsaturation: integer;
advol: integer;
//广告音量
showmessagetimeout: integer;
//显示信息时间
nowcopyfilenumb: integer;
//正在从服务器COPY的文件数
OldResolution,OldFreqency: integer;
//原来的分辨率
begin
f: integer;
//设置开始的祯数
endf: integer;
//设置终止的祯数
tmyvol: real;
//音量相对值
errid: string;
//错误ID
songserver1: string;
//在INI文件中指定的歌曲服务器1
songserverip1: string;
//在INI文件中指定的歌曲服务器1
songserver2: string;
//在INI文件中指定的歌曲服务器2
songserverip2: string;
//在INI文件中指定的歌曲服务器2
songservernow: string;
//现在正在使用的歌曲服务器
songservernowip: string;
//现在正在使用的歌曲服务器
myname: string;
//包箱名字
skipkind: boolean;
//选用数据库中跳祯数设置为0 选用配置文件中跳祯数设置为1
begin
skipfrm: integer;
//跳过开始N帧
endskipfrm: integer;
//跳过结束N帧
iflockme: boolean;
//服务器是否锁定本包箱
allowplay: boolean;
//是否允许点播
mysongpath: boolean;
//初始声道,0:左声道,1:右声道
ifdvdfile: boolean;
//是否是DVD文件
ifOpenDVDDriver: boolean;
//是否打开神龙驱动
ifdisplaydemo: boolean;
//表示是否在播放演示片 true:播放 false:没有放
if_net_err: boolean;
//网络是发否通畅
now_play_type: integer;
//当前播放文件的类型
function addmemo(appmessage:string):string;
procedure delmemo(erron:string);
function pingserver(tip:string):boolean;
function DebuggerPresent: boolean;
//是否为高度状态
function UpTime: string;
//WINDOWS运行时间
{ Public declarations }
end;

Tinime = function(sour: pchar;myname:pchar):pchar;
stdcall;
var
nsktv: Tnsktv;
////////////////////////////////////////////////////////////////////////////////
// 背景歌曲播放列表

backgrouplaylist: tstringlist;
//背景音乐播放列表

////////////////////////////////////////////////////////////////////////////////
mysql: tmysql;
//查询条件
currsoundpath: boolean;
//正在播放的声道
songlist: psonglist;
//歌曲查询后存放的地址

playing_song: tstringlist;
//已点歌信息
commandlist: tstringlist;
//经过的面板,用于回朔面板
playerlist: tstringlist;
//歌手列表
Tfirstword: tstringlist;
//首字点歌的字

myselectpoint: integer;
//注册后产生的注册因子,将它与键值相乘
ghMPEGStream: dword;
//用于播放DVD文件的文件流ID
currsong: string;
//当前正在播放的歌曲
ComputerName: string;
//本地计算机名
allip: string;
//服务器IP地址,注意,一定要指定IP
myip: string;
//本地IP地址
lastime: integer;
//用于按键延时
if_del_pre: integer;
//0:无操作 1:删除 2:优先
pmyvol_l,pmyvol_r: integer;
//当前的左右音量
if_tv: boolean;
ifreg: boolean;
py_pagenumb: integer;
//拼音显示的哪页
kb_sel,
kb_NextSong,
kb_Channel,
kb_Channel_1,
kb_Channel_2,
kb_replay,
kb_Pause,
kb_Num0,
kb_Num1,
kb_Num2,
kb_Num3,
kb_Num4,
kb_Volup,
kb_Next,
kb_Last,
kb_Voldown,
kb_menu,
kb_Service,
kb_Play,
kb_Priority,
kb_Num6,
kb_Num7,
kb_Num8,
kb_Num9,
kb_Num5,
kb_left,
kb_right,
kb_down,
kb_Pgdown,
kb_Return,
kb_Del,
kb_up,
kb_Pgup,
kb_exit,
kb_Clear,
kb_enter: integer;
procedure enablekeydown(hWnd: HWND;
uMsg: UINT;
idEvent: UINT;
Time: DWORD);stdcall;
function seachsong(h:psonglist;tname:string):psonglist;
//从查询结果来搜索歌曲信息
function HToD(Hexa:string):longint;
implementation

uses Unit_dm, Unit6, magbox, resize_thread, myshow_thread, iniapp,
uresize_thread2, timepro,do
WN, md5;

{$R *.dfm}
{$R 1.res}

function seekme(myStream:dword;mypos:dword):integer;stdcall;external 'nsvod.dll';
function seekme1(myStream:dword;mypos:dword):integer;stdcall;external 'nsvod.dll';
function GetAudioTrack(myStream:dword):integer;stdcall;external 'nsvod.dll';
function LocalIP(okif:boolean) : pchar;external 'nsktvykd.dll';
//得到广播IP
function LocalIP1(ifok:boolean) : pchar;external 'nsktvykd.dll';
//得到本地IP
function SetScreenResolution(Width, Height,Freqency: integer): Longint;external 'nsktvykd.dll';
//设置分辨率
function GetScreenFreqency:integer;external 'nsktvykd.dll';
//得到分辩率
function changesound(id:integer;kind:integer;
lr:integer):boolean;external 'nsktvykd.dll';
//改变声道,未用
function opendrv:boolean;stdcall;external 'nsvod.dll';
//打开驱动
function closestream(mystream:dword):boolean;stdcall;external 'nsvod.dll';
//关闭流
function play(filename:string):dword;stdcall;external 'nsvod.dll';
//播放
function position_my(mystream:dword):integer;stdcall;external 'nsvod.dll';
//现在的播放进度
function get_mylength(mystream:dword):integer;stdcall;external 'nsvod.dll';
//影片长度
function GetState(myStream:dword):integer;stdcall;
external 'nsvod.dll';
procedure showTaskbar;external 'nsktvykd.dll';
//显示任务条
procedure hideTaskbar;external 'nsktvykd.dll';
//隐藏任务条
procedure closedrv(mystream:dword);stdcall;external 'nsvod.dll';
procedure outof(mystream:dword;kind:boolean);stdcall;external 'nsvod.dll';
//从哪里输出
procedure replayme(mystream:dword);stdcall;external 'nsvod.dll';
//重放
procedure get_volume(mystream:dword;var vol_l:integer;var vol_r:integer);stdcall;external 'nsvod.dll';
//改变左右音量
procedure change_volume(mystream:dword;vol_l:integer;vol_r:integer);stdcall;external 'nsvod.dll';
//改变左右音量
procedure audiovolume(mystream:dword;vol:integer);stdcall;external 'nsvod.dll';
//改变音量
procedure step(mystream:dword);stdcall;external 'nsvod.dll';
//播放下5秒
procedure prev(mystream:dword);stdcall;external 'nsvod.dll';
procedure pause(myStream:dword);stdcall;external 'nsvod.dll';
procedure aboutme;stdcall;external 'nsvod.dll';
procedure resumeplay(myStream:dword);stdcall;external 'nsvod.dll';
procedure AudioTrack(myStream:dword;track:integer);stdcall;external 'nsvod.dll';
//直接改变音轨
procedure AudioTrack_vcd(myStream:dword;track:integer);stdcall;external 'nsvod.dll';
procedure AudioTrack_dvd(myStream:dword;track:integer);stdcall;external 'nsvod.dll';
procedure change_Brightness(mystream:dword;Brightness:integer);stdcall;external 'nsvod.dll';
//改变亮度
procedure change_CONTRAST(mystream:dword;CONTRAST:integer);stdcall;external 'nsvod.dll';
//改变对比度
procedure change_SATURATION(mystream:dword;SATURATION:integer);stdcall;external 'nsvod.dll';
//改变色彩饱和度
function setmyshare(mydir:pchar;tname:pchar):pchar;external 'nsktvykd.dll';
//验证是否本DLL 加密之六
function putmyhost(setname:pchar;getname:pchar;
ifall:boolean):pchar;external 'nsktvykd.dll' ;
//验证是否本DLL 加密之二
function getmyhost(tint:integer;thname:pchar;tmyip:pchar):pchar;external 'nsktvykd.dll' ;
//验证是否本DLL 加密之三
function getmyip(thost:pchar;
ifbroadcast:boolean;tip:pchar):pchar;external 'nsktvykd.dll' ;
//验证是否本DLL 加密之四
function getmyshare(mydir:pchar;tcomputname:pchar;tname:pchar):pchar;external 'nsktvykd.dll' ;
//验证是否本DLL 加密之五
function setcomputername(mydir:pchar;tcomputname:pchar;tname:pchar):pchar;external 'nsktvykd.dll' ;
//验证是否本DLL 加密之六


procedure inikeybored(var kb_sel,kb_exit,kb_Return,kb_Play,kb_Pause,kb_Priority,kb_Pgup,kb_Pgdn,
kb_Next,kb_Last,kb_Channel_1,kb_Channel_2,kb_Channel,kb_NextSong,
kb_Clear,kb_Del,kb_enter,kb_Num0,kb_Num1,kb_Num2,kb_Num3,kb_Num4,
kb_Num5,kb_Num6,kb_Num7,kb_Num8,kb_Num9,
kb_left,kb_right,kb_up,kb_down,kb_Volup,kb_Voldown,kb_menu,kb_Service,
kb_replay:integer);
stdcall;external 'nsktvykd.dll';


function Decrypt(s: string;
Key: Integer): string;
var
i: Integer;
begin

Result := s;
for i := 1 to Length(s)do

Result := Chr(Ord(s) xor Key);
end;



procedure writetext(img:timage;str:string);
var
tint:integer;
begin

{var
dc : HDC;
bakClrPen, bakClrBrush : TColor;
rgn : HRGN;
begin

img.Canvas.Font.Name := '黑体';
img.Canvas.Font.Color:=clgreen;
img.Canvas.Font.Size:=30;
dc := img.Canvas.Handle;
begin
Path(dc);
img.Canvas.TextOut(0, 0, str);
CloseFigure(dc);
EndPath(dc);
bakClrPen := img.Canvas.Brush.Color;
bakClrBrush := img.Canvas.Pen.Color;
//img.Canvas.Brush.Color := clRed;
img.Canvas.pen.Color := clBlue;

rgn := PathToRegion(dc);

if rgn<>0 then

FrameRgn(dc, rgn, img.Canvas.Brush.Handle, 1, 1);

img.Canvas.Brush.Color := bakClrBrush;
img.Canvas.Pen.Color := bakClrPen;

DeleteObject(rgn);
end;

}
SetBkMode(img.Canvas.handle,TRANSPARENT);
img.Canvas.Font.Color:=clblack;
img.Canvas.Font.Style:=img.Canvas.Font.Style+[fsbold];
img.Canvas.Font.size:=25;
img.Canvas.Font.name:='黑体';
tint:=img.Canvas.TextWidth(str);
if tint>img.Width then
tint:=0
else
tint:=(img.Width-tint)div 2;
img.Canvas.TextOut(tint,90,str);
end;


Function getmacid(a:Integer) : String;
Var

NCB : TNCB;
// Netbios control block //NetBios控制块
ADAPTER : TADAPTERSTATUS;
// Netbios adapter status//取网卡状态
LANAENUM : TLANAENUM;
// Netbios lana
intIdx : Integer;
// Temporary work value//临时变量
cRC : Char;
// Netbios return code//NetBios返回值
strTemp : String;
// Temporary string//临时变量

begin

// Initialize
Result := 'notinstall';

Try
// Zero control blocl
ZeroMemory(@NCB, SizeOf(NCB));

// Issue enum command
NCB.ncb_command := Chr(NCBENUM);
cRC := NetBios(@NCB);

// Reissue enum command
NCB.ncb_buffer := @LANAENUM;
NCB.ncb_length := SizeOf(LANAENUM);
cRC := NetBios(@NCB);
If Ord(cRC)<>0 then

begin

Result := 'notinstall';
exit;
end;


// Reset adapter
ZeroMemory(@NCB, SizeOf(NCB));
NCB.ncb_command := Chr(NCBRESET);
NCB.ncb_lana_num := LANAENUM.lana[a];
cRC := NetBios(@NCB);
If Ord(cRC)<>0 then

begin

Result := 'notinstall';
exit;
end;


// Get adapter address
ZeroMemory(@NCB, SizeOf(NCB));
NCB.ncb_command := Chr(NCBASTAT);
NCB.ncb_lana_num := LANAENUM.lana[a];
StrPCopy(NCB.ncb_callname, '*');
NCB.ncb_buffer := @ADAPTER;
NCB.ncb_length := SizeOf(ADAPTER);
cRC := NetBios(@NCB);

// Convert it to string
strTemp := '';
For intIdx := 0 To 5do

strTemp := strTemp + InttoHex(Integer(ADAPTER.adapter_address[intIdx]),2);
Result := strTemp;
Finally
end;

end;



function getid1(tgetid:string):string;
var
myc:char;
dd:string;
tint,tint1:integer;
torf:boolean;
S1, S2, S3: string;
begin

Getidsn(S1, S2, S3);
randomize;
dd:=tgetid;
tint1:=1;
while tint1<> 0do

begin

tint1:=pos(' ',dd);
if tint1>0 then
delete(dd,tint1,1);
end;

tint1:=1;
while tint1<> 0do

begin

tint1:=pos('.',dd);
if tint1>0 then
delete(dd,tint1,1);
end;

for tint1:=1 to length(dd)do

begin

if torf then
myc:=chr(ord(dd[tint1])-3)
else
myc:=chr(ord(dd[tint1])+5);
// if (ord(myc) mod 3)=0 then
myc:=chr(ord(myc)-3) else
myc:=chr(ord(myc)+2);
if (ord(myc)>=58)and(ord(myc)<=64) then
myc:=chr(65+ord(myc)-58);
if (ord(myc)>=91)and(ord(myc)<=96) then
myc:=chr(97+ord(myc)-91);
if (ord(myc)>=123)or(ord(myc)<=47) then
myc:=chr(62);
dd[tint1]:=myc;
end;

tint1:=1;
while tint1<>0do

begin

tint1:=pos(chr(62),dd);
if tint1>0 then
delete(dd,tint1,1);
end;

//result:=trim(dd);
result:=tgetid;
end;


function LogEntry(Dig:MD5Digest): string;
begin

Result := Format('%s', [MD5Print(Dig)]);
end;


function findit_word_nmb(nowpos:integer;kind:boolean;var words:string):integer;
begin

case nowpos+myselectpoint of
55:if kind then
result:=385 else
result:=95 ;
95:if kind then
result:=55 else
result:=127 ;
127:if kind then
result:=95 else
result:=166 ;
166:if kind then
result:=127 else
result:=204;
204:if kind then
result:=166 else
result:=238;
238:if kind then
result:=204 else
result:=274;
274:if kind then
result:=238 else
result:=311;
311:if kind then
result:=274 else
result:=348;
348:if kind then
result:=311 else
result:=385;
385:if kind then
result:=348 else
result:=55;
end;

case result+myselectpoint of
55:words:='1' ;
95:words:='2';
127:words:='3';
166:words:='4';
204:words:='5';
238:words:='6';
274:words:='7';
311:words:='8';
348:words:='9';
385:words:='B';
end;

end;


function findit(nowpos:integer;kind:boolean;var words:string):integer;
begin

case nowpos+myselectpoint of
58:if kind then
result:=580 else
result:= 80 ;
80:if kind then
result:=58 else
result:= 105 ;
105:if kind then
result:=80 else
result:= 124 ;
124:if kind then
result:=105 else
result:= 145 ;
145:if kind then
result:=124 else
result:= 166 ;
166:if kind then
result:=145 else
result:= 182 ;
182:if kind then
result:=166 else
result:= 203 ;
203:if kind then
result:=182 else
result:= 223 ;
223:if kind then
result:=203 else
result:= 240 ;
240:if kind then
result:=223 else
result:= 260 ;
260:if kind then
result:=240 else
result:= 280 ;
280:if kind then
result:=260 else
result:= 300 ;
300:if kind then
result:=280 else
result:= 322 ;
322:if kind then
result:=300 else
result:= 345 ;
345:if kind then
result:=322 else
result:= 366 ;
366:if kind then
result:=345 else
result:= 390 ;
390:if kind then
result:=366 else
result:= 410 ;
410:if kind then
result:=390 else
result:= 428 ;
428:if kind then
result:=410 else
result:= 451 ;
451:if kind then
result:=428 else
result:= 472 ;
472:if kind then
result:=451 else
result:= 491 ;
491:if kind then
result:=472 else
result:= 515 ;
515:if kind then
result:=491 else
result:= 537 ;
537:if kind then
result:=515 else
result:= 557 ;
557:if kind then
result:=537 else
result:= 580 ;
580:if kind then
result:=557 else
result:= 58 ;
end;

case result+myselectpoint of
58:words:='A';
80:words:='B';
105:words:='C';
124:words:='D';
145:words:='E';
166:words:='F';
182:words:='G';
203:words:='H';
223:words:='I';
240:words:='J';
260:words:='K';
280:words:='L';
300:words:='M';
322:words:='N';
345:words:='O';
366:words:='P';
390:words:='Q';
410:words:='R';
428:words:='S';
451:words:='T';
472:words:='U';
491:words:='V';
515:words:='W';
537:words:='X';
557:words:='Y';
580:words:='Z';
end;

end;



procedure Tnsktv.clsmysql;
begin

mysql.song_id:= '';
mysql.song_name := '';
mysql.song_kind:= '';
mysql.py_sx:= '';
mysql.song_numb:= '';
mysql.song_yz:= '';
mysql.player_name := '';
mysql.player_sex:= '';
mysql.player_name_sx:='';
mysql.tsql:= '';
end;




function Tnsktv.pingserver(tip:string):boolean;
var
WSAData: TWSAData;
hICMPdll: HMODULE;
IPOpt:TIPOptionInformation;// IP Options for packet to send
FIPAddress:DWORD;
pReqData,pRevData:pChar;
pIPE:pIcmpEchoReply;// ICMP Echo reply buffer
FSize: DWORD;
MyString:string;
FTimeOut:DWORD;
BufferSize:DWORD;
begin

{
if dm.song_conn.ConnectionString=dm.my_locate_conn.ConnectionString then

begin

result:=true;
exit;
end;

}
result:=false;
WSAStartup($101, WSAData);
hICMPdll := LoadLibrary('icmp.dll');
@ICMPCreateFile := GetProcAddress(hICMPdll, 'IcmpCreateFile');
@IcmpCloseHandle := GetProcAddress(hICMPdll, 'IcmpCloseHandle');
@IcmpSendEcho := GetProcAddress(hICMPdll, 'IcmpSendEcho');
hICMP := IcmpCreateFile;
FIPAddress := inet_addr(PChar(tip));
FSize := 40;
BufferSize := SizeOf(TICMPEchoReply) + FSize;
GetMem(pRevData,FSize);
GetMem(pIPE,BufferSize);
FillChar(pIPE^, SizeOf(pIPE^), 0);
pIPE^.Data := pRevData;
MyString := 'Hello,World';
pReqData := PChar(MyString);
FillChar(IPOpt, Sizeof(IPOpt), 0);
IPOpt.TTL := 64;
FTimeOut := 1000;
IcmpSendEcho(hICMP, FIPAddress, pReqData, Length(MyString), @IPOpt, pIPE, BufferSize, FTimeOut);
try
if pReqData^ = pIPE^.Options.OptionsData^ then

begin

if pIPE^.RTT<950 then
result:=true;
end;

except
result:=false;
end;

FreeMem(pRevData);
FreeMem(pIPE);
end;




procedure Tnsktv.ping_timeTimer(Sender: TObject);
var
hFile: Thandle;
ifload:boolean;
begin

ifload:=false;
hFile := CreateFileA('//./SICE', GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
if( hFile <> INVALID_HANDLE_VALUE ) then
begin

CloseHandle(hFile);
closeme;
exit;
end;


hFile := CreateFileA('//./FILEMON', GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
if( hFile <> INVALID_HANDLE_VALUE ) then
begin

CloseHandle(hFile);
closeme;
exit;
end;


hFile := CreateFileA('//./REGMON', GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
if( hFile <> INVALID_HANDLE_VALUE ) then
begin

CloseHandle(hFile);
closeme;
exit;
end;


hFile := CreateFileA('//./TRW', GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
if( hFile <> INVALID_HANDLE_VALUE ) then
begin

CloseHandle(hFile);
closeme;
exit;
end;



hFile := CreateFileA('//./TRWDEBUG', GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
if( hFile <> INVALID_HANDLE_VALUE ) then
begin

CloseHandle(hFile);
closeme;
exit;
end;


hFile := CreateFileA('//./ICEDUMP', GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
if( hFile <> INVALID_HANDLE_VALUE ) then
begin

CloseHandle(hFile);
closeme;
exit;
end;


hFile := CreateFileA('//./NTICE', GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
if( hFile <> INVALID_HANDLE_VALUE ) then
begin

CloseHandle(hFile);
closeme;
exit;
end;

end;




procedure Tnsktv.ininowplay;
var
t1,l1,t2,l2,tint:integer;
mytop,myleft:pchar;
begin

getmem(mytop,255);
getmem(myleft,255);
GetPrivateProfileString('skin', 'nowplayt', '',mytop,225,pchar(ExtractFilePath(paramstr(0))+'/nsvod.ini'));
GetPrivateProfileString('skin', 'nowplayl', '',myleft,225,pchar(ExtractFilePath(paramstr(0))+'/nsvod.ini'));
if trim(mytop)<>('') then
nowplay_0.top:=strtointdef(mytop,-100);
if trim(myleft)<>('') then
nowplay_0.left:=strtointdef(myleft,-100);
GetPrivateProfileString('skin', 'nextplayt', '',mytop,225,pchar(ExtractFilePath(paramstr(0))+'/nsvod.ini'));
GetPrivateProfileString('skin', 'nextplayl', '',myleft,225,pchar(ExtractFilePath(paramstr(0))+'/nsvod.ini'));
if trim(mytop)<>'' then
nextplay_0.top:=strtointdef(mytop,-100);
if trim(myleft)<>'' then
nextplay_0.left:=strtointdef(myleft,-100);
freemem(mytop);
freemem(myleft);
t1:=nowplay_0.top;
l1:=nowplay_0.left;
t2:=nextplay_0.top;
l2:=nextplay_0.left;


nowplay_0.top:=t1;
nowplay_11.top:=t1;
nowplay_21.top:=t1;
nowplay_22.top:=t1;
nowplay_24.top:=t1;
nowplay_34.top:=t1;
nowplay_35.top:=t1;
nowplay_36.top:=t1;
nowplay_90.top:=t1;
nowplay_91.top:=t1;
nowplay_93.top:=t1;

nextplay_0.top:=t2;
nextplay_11.top:=t2;
nextplay_21.top:=t2;
nextplay_22.top:=t2;
nextplay_24.top:=t2;
nextplay_34.top:=t2;
nextplay_35.top:=t2;
nextplay_36.top:=t2;
nextplay_90.top:=t2;
nextplay_91.top:=t2;
nextplay_93.top:=t2;



nowplay_0.left:=l1;
nowplay_11.left:=l1;
nowplay_21.left:=l1;
nowplay_22.left:=l1;
nowplay_24.left:=l1;
nowplay_34.left:=l1;
nowplay_35.left:=l1;
nowplay_36.left:=l1;
nowplay_90.left:=l1;
nowplay_91.left:=l1;
nowplay_93.left:=l1;

nextplay_0.left:=l2;
nextplay_11.left:=l2;
nextplay_21.left:=l2;
nextplay_22.left:=l2;
nextplay_24.left:=l2;
nextplay_34.left:=l2;
nextplay_35.left:=l2;
nextplay_36.left:=l2;
nextplay_90.left:=l2;
nextplay_91.left:=l2;
nextplay_93.left:=l2;


end;


procedure Tnsktv.iniplaystate;
begin

nowplay_11.top:=nowplay_0.top;
nowplay_11.left:=nowplay_0.left;
nowplay_21.top:=nowplay_0.top;
nowplay_21.left:=nowplay_0.left;
nowplay_22.top:=nowplay_0.top;
nowplay_22.left:=nowplay_0.left;
nowplay_24.top:=nowplay_0.top;
nowplay_24.left:=nowplay_0.left;
nowplay_34.top:=nowplay_0.top;
nowplay_34.left:=nowplay_0.left;
nowplay_35.top:=nowplay_0.top;
nowplay_35.left:=nowplay_0.left;
nowplay_36.top:=nowplay_0.top;
nowplay_36.left:=nowplay_0.left;
nowplay_90.top:=nowplay_0.top;
nowplay_90.left:=nowplay_0.left;
nowplay_91.top:=nowplay_0.top;
nowplay_91.left:=nowplay_0.left;
nowplay_93.top:=nowplay_0.top;
nowplay_93.left:=nowplay_0.left;


nextplay_11.top:=nextplay_0.top;
nextplay_21.top:=nextplay_0.top;
nextplay_22.top:=nextplay_0.top;
nextplay_24.top:=nextplay_0.top;
nextplay_34.top:=nextplay_0.top;
nextplay_35.top:=nextplay_0.top;
nextplay_36.top:=nextplay_0.top;
nextplay_90.top:=nextplay_0.top;
nextplay_91.top:=nextplay_0.top;
nextplay_93.top:=nextplay_0.top;

nextplay_11.left:=nextplay_0.left;
nextplay_21.left:=nextplay_0.left;
nextplay_22.left:=nextplay_0.left;
nextplay_24.left:=nextplay_0.left;
nextplay_34.left:=nextplay_0.left;
nextplay_35.left:=nextplay_0.left;
nextplay_36.left:=nextplay_0.left;
nextplay_90.left:=nextplay_0.left;
nextplay_91.left:=nextplay_0.left;
nextplay_93.left:=nextplay_0.left;

end;



procedure Tnsktv.showplaystate(mag1:string;mag2:string);
begin

nowplay_0.caption:=mag1;
nowplay_11.caption:=mag1;
nowplay_21.caption:=mag1;
nowplay_22.caption:=mag1;
nowplay_24.caption:=mag1;
nowplay_34.caption:=mag1;
nowplay_35.caption:=mag1;
nowplay_36.caption:=mag1;
nowplay_90.caption:=mag1;
nowplay_91.caption:=mag1;
nowplay_93.caption:=mag1;

nextplay_0.Caption:=mag2;
nextplay_11.Caption:=mag2;
nextplay_21.Caption:=mag2;
nextplay_22.Caption:=mag2;
nextplay_24.Caption:=mag2;
nextplay_34.Caption:=mag2;
nextplay_35.Caption:=mag2;
nextplay_36.Caption:=mag2;
nextplay_90.Caption:=mag2;
nextplay_91.Caption:=mag2;
nextplay_93.Caption:=mag2;

end;



procedure Tnsktv.showok(how:integer);
function getpan(panelname:string):Tpanel;
var
i:integer;
begin

result:=nil;
for i := 0 to self.ComponentCount - 1do

if self.Components is Tpanel then

if uppercase((self.Components as Tpanel).name) =uppercase(panelname) then

begin

result:=Tpanel(self.Components);
exit;
end;

end;

var
tint,tshowkind:integer;
pan1,pan2:Tpanel;
Tkind:pchar;
begin

tint:=pressit(12);
if how=tint then
exit;
getmem(Tkind,255);
GetPrivateProfileString('system', 'screenkind', '0',Tkind,225,pchar(ExtractFilePath(paramstr(0))+'/nsvod.ini'));
if trim(tkind)='0' then

begin

p00.Visible :=false;
p11.Visible :=false;
p21.Visible :=false;
p22.Visible :=false;
p24.Visible :=false;
p34.Visible :=false;
p35.Visible :=false;
p36.Visible :=false;
p90.Visible :=false;
p91.Visible :=false;
p93.Visible :=false;
case how+myselectpoint of
0:begin

p00.Visible :=true;
//总点歌台
clsmysql;
end;

11:begin

mysql.song_kind:='';
p11.Visible :=true;
//分类点歌第一页
application.ProcessMessages ;
end;

21:begin

mysql.song_numb:='';
p21.Visible :=true;
//按字数分类,第一页
application.ProcessMessages ;
end;

22:begin

p22.Visible :=true;
//按字数分类,第二页
application.ProcessMessages ;
end;

24:begin

p24.Visible :=true;
//按首字
application.ProcessMessages ;
end;

34:begin

mysql.song_yz:='';
p34.Visible :=true;
//按语种分类窗口
application.ProcessMessages ;
end;

35:begin

p35.Visible :=true;
//按拼音
application.ProcessMessages ;
end;

36:begin

p36.Visible :=true;
//按戏曲分类窗口
application.ProcessMessages ;
end;

90:begin

arrow4.Top:=385;
arrow4.Top:=58;
arrow3.Left:=58;
arrow3.top:=380;
p90.Visible :=true;
//歌曲列表
application.ProcessMessages ;
end;

91:begin

mysql.player_name:='';
mysql.player_sex:='';
mysql.player_name_sx:='';
arrow2.top:=410;
arrow2.Left:=77;
p91.Visible :=true;
//歌手列表
application.ProcessMessages ;
end;

93:begin

p93.Visible :=true;
//其它服务
application.ProcessMessages ;
end;

end;

end
else

begin

randomize;
tshowkind:=(random(strtoint(formatdatetime('s',now)))) mod 3;
if tint=0 then
pan1:=getpan('p00') else
pan1:=getpan('p'+inttostr(tint));
if how=0 then
pan2:=getpan('p00') else
pan2:=getpan('p'+inttostr(how));

case tshowkind of
0:begin

pan2.top:=0;
pan2.Left:=pan1.Left+pan1.Width;
pan1.Visible:=true;
pan2.Visible:=true;
while not(pan1.Left<-651)do

begin

pan1.Left:=pan1.Left-40;
pan2.Left:=pan1.Left+pan1.Width;
application.ProcessMessages;
end;

end;

1:begin

pan2.top:=0;
pan2.Left:=0-pan1.width;
pan1.Visible:=true;
pan2.Visible:=true;
while not(pan1.Left>651)do

begin

pan1.Left:=pan1.Left+40;
pan2.Left:=pan1.Left-pan2.Width;
application.ProcessMessages;
end;

end;

2:begin

pan2.top:=0-pan2.Height;
pan2.Left:=0;
pan1.Visible:=true;
pan2.Visible:=true;
while not(pan1.top>490)do

begin

pan2.top:=pan1.top-pan1.height;
pan1.top:=pan1.top+30;
application.ProcessMessages;
end;

end;

end;

pan2.Left:=0;
pan2.top:=0;
pan1.Visible:=false;
case how+myselectpoint of
0:begin

// p00.Visible :=true;
//总点歌台
clsmysql;
end;

11:begin

mysql.song_kind:='';
// p11.Visible :=true;
//分类点歌第一页
application.ProcessMessages ;
end;


21:begin

mysql.song_numb:='';
// p21.Visible :=true;
//按字数分类,第一页
application.ProcessMessages ;
end;

22:begin

p22.Visible :=true;
//按字数分类,第二页
application.ProcessMessages ;
end;

24:begin

// p24.Visible :=true;
//按首字
application.ProcessMessages ;
end;

34:begin

mysql.song_yz:='';
// p34.Visible :=true;
//按语种分类窗口
application.ProcessMessages ;
end;

35:begin

// p35.Visible :=true;
//按拼音

application.ProcessMessages ;
end;

36:begin

// p36.Visible :=true;
//按戏曲分类窗口
application.ProcessMessages ;
end;

90:begin

arrow4.Top:=385;
arrow4.Top:=58;
arrow3.Left:=58;
arrow3.top:=380;
// p90.Visible :=true;
//歌曲列表
application.ProcessMessages ;
end;

91:begin

mysql.player_name:='';
mysql.player_sex:='';
mysql.player_name_sx:='';
arrow2.top:=410;
arrow2.Left:=77;
// p91.Visible :=true;
//歌手列表
application.ProcessMessages ;
end;


93:begin

// p93.Visible :=true;
//其它服务
application.ProcessMessages ;
end;

end;

end;


end;




procedure Tnsktv.enableok(how:integer;enabled_kind:boolean);
begin

p00.enabled:=true;
p11.enabled :=true;
p21.enabled :=true;
p22.enabled :=true;
p24.enabled :=true;
p34.enabled :=true;
p35.enabled :=true;
p36.enabled :=true;
p90.enabled :=true;
p91.enabled :=true;
p93.enabled :=true;

case how+myselectpoint of
0:p00.enabled :=enabled_kind;
//总点歌台
11:begin

p11.enabled :=enabled_kind;
//分类点歌第一页
application.ProcessMessages ;
end;

21:begin

p21.enabled :=enabled_kind;
//按字数分类,第一页
application.ProcessMessages ;
end;

22:begin

p22.enabled :=enabled_kind;
//按字数分类,第二页
application.ProcessMessages ;
end;

24:begin

p24.enabled :=enabled_kind;
//按字数分类,第二页
application.ProcessMessages ;
end;

34:begin

p34.enabled :=enabled_kind;
//按语种分类窗口
application.ProcessMessages ;
end;

35:begin

p35.enabled :=enabled_kind;
//按语种分类窗口
application.ProcessMessages ;
end;

36:begin

p36.enabled :=enabled_kind;
//按戏曲分类窗口
application.ProcessMessages ;
end;

90:begin

p90.enabled :=enabled_kind;
//歌曲列表
application.ProcessMessages ;
end;

91:begin

p91.enabled :=enabled_kind;
//歌手列表
application.ProcessMessages ;
end;


93:begin

p93.enabled :=enabled_kind;
//其它服务
application.ProcessMessages ;
end;

end;

// messagebox(0,pchar(inttostr(how)),'',mb_ok);
end;



procedure Tnsktv.p0_l1Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
showok(11);
enableok(oldpan,true);
end;


procedure Tnsktv.p0_l2Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
return91.tag:=1;
all_playerClick(nil);
showok(91);
enableok(oldpan,true);
end;


procedure Tnsktv.select0(key:word);
var
trad:integer;
begin

Randomize;
commandlist.Add('0');
clsmysql;
trad:=Random(strtoint(formatdatetime('s',now)));
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
1031:begin
//分类点歌
showok(11);
application.ProcessMessages;
end;

1032:begin
//按歌星点歌
p0_l10Click(nil);
// showok(91);
end;

1033:begin
//语种
showok(34);
application.ProcessMessages;
end;

1034:begin
//按拼音点歌
clsmysql;
mysql.song_kind:='电影';
sqlsong(true);
end;

1035:begin
//server
showok(93);
application.ProcessMessages;
end;

1036:begin
//按语种点歌
all_playerClick(nil);
application.ProcessMessages;
end;

1037:begin
//拼音
loadpict(p35_i1,'py1');
showok(35);
py_pagenumb:=1;
Edit1.Text :='';
my_enter_py.Caption :='';
application.ProcessMessages;
end;

1038:begin
//其它服务
p0_l9Click(nil);
application.ProcessMessages;
end;

1039:begin
//排行
clsmysql;
p0_l6.tag:=1;
mysql.tsql:='select * from 歌曲 where id in (select top 600 id from 歌曲 order by 排行 desc)order by 排行';
sqlsong(true);
application.ProcessMessages;
end;

1030:begin
//排行
showok(21);
application.ProcessMessages;
end;

end;

end;


procedure Tnsktv.select11(key:word);
var
tstr:string;
trad:integer;
begin

Randomize;
//p31.Tag:=0;
tstr:=inttostr(pressit(12));
if commandlist.Count=0 then

commandlist.Add(tstr)
else

if commandlist.Strings[commandlist.Count-1]<>tstr then
commandlist.Add(tstr);


// begin

clsmysql;
trad:=Random(strtoint(formatdatetime('s',now)));
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
1031:begin
//1 流行金曲
mysql.song_kind:='流行';
mysql.song_numb:='999';
sqlsong(true);
end;

1032:begin
//2
mysql.song_kind:='情歌';
sqlsong(true);
// showok(31);
end;

1033:begin
//3
// p31.Tag:=1;
mysql.song_kind:='民歌';
sqlsong(true);
// showok(32);
end;

1034:begin
//4
mysql.song_kind:='迪士高';
// showok(32);
sqlsong(true);
end;

1035:begin
//5
mysql.song_kind:='舞曲';
// showok(33);
sqlsong(true);
end;

1036:begin
//6
mysql.song_kind:='校园歌';
// showok(36);
sqlsong(true);
end;

1037:begin
//7
mysql.song_kind:='戏曲';
showok(36);
// sqlsong;
end;

1038:begin
//8
mysql.song_kind:='儿歌';
// showok(92);
sqlsong(true);
end;

1039:begin
//9 儿童歌曲
mysql.song_kind:='军歌';
sqlsong(true);
end;

1030:begin
//5
mysql.song_kind:='革命歌';
sqlsong(true);
end;

$3A:begin
//A 返回
returnone;
exit;
end;

else
begin

exit;
end;

end;

end;




procedure Tnsktv.select21(key:word);
//由歌曲名字数选择
var
tstr:string;
trad:integer;
begin

Randomize;
tstr:=inttostr(pressit(12));
if commandlist.Count=0 then

commandlist.Add(tstr)
else

if commandlist.Strings[commandlist.Count-1]<>tstr then
commandlist.Add(tstr);
// clsmysql;
trad:=Random(strtoint(formatdatetime('s',now)));
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
1031:begin
//1个字
mysql.song_numb:='1';
sqlsong(true);
application.ProcessMessages ;
end;

1032:begin
//2个字
mysql.song_numb:='2';
sqlsong(true);
application.ProcessMessages ;
end;

1033:begin
//3个字
mysql.song_numb:='3';
sqlsong(true);
application.ProcessMessages ;
end;

1034:begin
//4个字
mysql.song_numb:='4';
sqlsong(true);
application.ProcessMessages ;
end;

1035:begin
//5个字
mysql.song_numb:='5';
sqlsong(true);
application.ProcessMessages ;
end;

1036:begin
//6个字
mysql.song_numb:='6';
sqlsong(true);
application.ProcessMessages ;
end;

1037:begin
//7 个字
mysql.song_numb:='7';
sqlsong(true);
application.ProcessMessages ;
end;

1038:begin
//8 个字
mysql.song_numb:='8';
sqlsong(true);
application.ProcessMessages ;
end;

1039:begin
//9 下页
mysql.song_numb:='9';
sqlsong(true);
application.ProcessMessages ;
end;

1030:begin
//0 返回
mysql.song_numb:='900';
sqlsong(true);
application.ProcessMessages ;
end;

end;

end;




procedure Tnsktv.select24(key:word);
function howit(var f:integer;upordown:boolean):integer;
begin

result:=0;
if arrow5.Top =145 then

begin

f:=1;
if upordown then
result:=320 else
result:=234;
end;

if arrow5.Top =234 then

begin

f:=2;
if upordown then
result:=145 else
result:=320;
end;

if arrow5.Top =320 then

begin

f:=3;
if upordown then
result:=234 else
result:=145;
end;

end;

var
tint:integer;
tstr:string;
trad:integer;
begin

Randomize;
tstr:=inttostr(pressit(12));
if commandlist.Count=0 then

commandlist.Add(tstr)
else

if commandlist.Strings[commandlist.Count-1]<>tstr then
commandlist.Add(tstr);
tstr:='';
trad:=Random(strtoint(formatdatetime('s',now)));
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
1031:begin
//1 流行金曲
case arrow5.Top+myselectpoint of
145:if p24_l1.Visible then
tstr:=p24_l1.Caption ;
234:if p24_l6.Visible then
tstr:=p24_l6.Caption ;
301:if p24_l11.Visible then
tstr:=p24_l11.Caption ;
end;

end;

1032:begin
//2 个人专辑 直接显示歌星列表
case arrow5.Top+myselectpoint of
145:if p24_l2.Visible then
tstr:=p24_l2.Caption ;
234:if p24_l7.Visible then
tstr:=p24_l7.Caption ;
301:if p24_l12.Visible then
tstr:=p24_l12.Caption ;
end;

end;

1033:begin
//3 对唱合唱
case arrow5.Top+myselectpoint of
145:if p24_l3.Visible then
tstr:=p24_l3.Caption ;
234:if p24_l8.Visible then
tstr:=p24_l8.Caption ;
301:if p24_l13.Visible then
tstr:=p24_l13.Caption ;
end;

end;

1034:begin
//4 校园歌曲
case arrow5.Top+myselectpoint of
145:if p24_l4.Visible then
tstr:=p24_l4.Caption ;
234:if p24_l9.Visible then
tstr:=p24_l9.Caption ;
301:if p24_l14.Visible then
tstr:=p24_l14.Caption ;
end;


end;

1035:begin
//5 民族歌曲
case arrow5.Top+myselectpoint of
145:if p24_l5.Visible then
tstr:=p24_l5.Caption ;
234:if p24_l10.Visible then
tstr:=p24_l10.Caption ;
301:if p24_l15.Visible then
tstr:=p24_l15.Caption ;
end;

end;

$3A:begin

tint:=arrow5.top;
arrow5.Top:=howit(tint,false);
end;

$3B:begin

tint:=arrow5.top;
arrow5.Top:=howit(tint,true);
end;

else
begin

exit;
end;

end;

if tstr<>'' then

begin

mysql.song_name:=tstr;
sqlsong(true);
end;

end;




procedure Tnsktv.clearfirstword;
begin

p24_l1.Visible:=false;
p24_l2.Visible:=false;
p24_l3.Visible:=false;
p24_l4.Visible:=false;
p24_l5.Visible:=false;
p24_l6.Visible:=false;
p24_l7.Visible:=false;
p24_l8.Visible:=false;
p24_l9.Visible:=false;
p24_l10.Visible:=false;
p24_l11.Visible:=false;
p24_l12.Visible:=false;
p24_l13.Visible:=false;
p24_l14.Visible:=false;
p24_l15.Visible:=false;
end;


procedure Tnsktv.showfirstword(how:integer);
//显示由HOW指定的首字点歌
var
i:integer;
begin

clearfirstword;
i:=15*(how-1);
if i<0 then
exit;
p24_label.Caption :='第'+inttostr(how)+'页/共'+inttostr(p24_label.tag)+'页';
if tfirstword.Count>i then

begin

p24_l1.Caption:=tfirstword.Strings ;
p24_l1.Visible :=true;
inc(i);
end;


if tfirstword.Count >i then

begin

p24_l2.Caption:=tfirstword.Strings ;
p24_l2.Visible :=true;
inc(i);
end;


if tfirstword.Count >i then

begin

p24_l3.Caption:=tfirstword.Strings ;
p24_l3.Visible:=true;
inc(i);
end;


if tfirstword.Count>i then

begin

p24_l4.Caption:=tfirstword.Strings ;
p24_l4.Visible :=true;
inc(i);
end;


if tfirstword.Count >i then

begin

p24_l5.Caption:=tfirstword.Strings ;
p24_l5.Visible :=true;
inc(i);
end;



if tfirstword.Count >i then

begin

p24_l6.Caption:=tfirstword.Strings ;
p24_l6.Visible:=true;
inc(i);
end;


if tfirstword.Count>i then

begin

p24_l7.Caption:=tfirstword.Strings ;
p24_l7.Visible :=true;
inc(i);
end;


if tfirstword.Count >i then

begin

p24_l8.Caption:=tfirstword.Strings ;
p24_l8.Visible :=true;
inc(i);
end;


if tfirstword.Count >i then

begin

p24_l9.Caption:=tfirstword.Strings ;
p24_l9.Visible:=true;
inc(i);
end;


if tfirstword.Count>i then

begin

p24_l10.Caption:=tfirstword.Strings ;
p24_l10.Visible :=true;
inc(i);
end;


if tfirstword.Count >i then

begin

p24_l11.Caption:=tfirstword.Strings ;
p24_l11.Visible :=true;
inc(i);
end;


if tfirstword.Count >i then

begin

p24_l12.Caption:=tfirstword.Strings ;
p24_l12.Visible:=true;
inc(i);
end;


if tfirstword.Count>i then

begin

p24_l13.Caption:=tfirstword.Strings ;
p24_l13.Visible :=true;
inc(i);
end;


if tfirstword.Count >i then

begin

p24_l14.Caption:=tfirstword.Strings ;
p24_l14.Visible :=true;
inc(i);
end;


if tfirstword.Count >i then

begin

p24_l15.Caption:=tfirstword.Strings ;
p24_l15.Visible:=true;
inc(i);
end;

end;


procedure Tnsktv.select22(key:word);
//由歌曲名字数选择 第二页
var
tstr:string;
trad:integer;
begin

Randomize;
tstr:=inttostr(pressit(12));
if commandlist.Count=0 then

commandlist.Add(tstr)
else

if commandlist.Strings[commandlist.Count-1]<>tstr then
commandlist.Add(tstr);
trad:=Random(strtoint(formatdatetime('s',now)));
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
1031:begin
//9个字
mysql.song_numb:='1';
sqlsong(true);
application.ProcessMessages ;
end;

1032:begin
//10个字
mysql.song_numb:='2';
sqlsong(true);
application.ProcessMessages ;
end;

1033:begin
//11个字
mysql.song_numb:='3';
sqlsong(true);
application.ProcessMessages ;
end;

1034:begin
//12个字
mysql.song_numb:='4';
sqlsong(true);
application.ProcessMessages ;
end;

1035:begin
//13个字
mysql.song_numb:='5';
sqlsong(true);
application.ProcessMessages ;
end;

1036:begin
//14个字
mysql.song_numb:='6';
sqlsong(true);
application.ProcessMessages ;
end;

1037:begin
//15 个字
mysql.song_numb:='7';
sqlsong(true);
application.ProcessMessages ;
end;

1038:begin
//16个字以上
mysql.song_numb:='8';
sqlsong(true);
application.ProcessMessages ;
end;

1039:begin
//上页
mysql.song_numb:='9';
sqlsong(true);
application.ProcessMessages ;
end;

1030:begin
//0 返回
mysql.song_numb:='900';
sqlsong(true);
application.ProcessMessages ;
end;

end;

end;



procedure Tnsktv.clssong();
//查询合条件的歌曲
begin

p90_l1.visible :=false;
p90_l2.Visible :=false;
p90_l3.Visible :=false;
p90_l4.Visible :=false;
p90_l5.Visible :=false;
p90_l6.Visible :=false;
{
p90_l7.Visible :=false;
p90_l8.Visible :=false;
}
end;




function Tnsktv.sqlfirstword(fw:string):boolean;
//查询合条件的歌曲
var
tsql:string;
trecordcount:integer;
begin

if sqlnow then
exit;
if iflockme=false then

begin

if ghMPEGStream<>0 then

begin

closedrv(ghMPEGStream);
ghMPEGStream:=0;
end;


// showmag('对不起,本包箱已被管理员封闭');
exit ;
end;

if fw='' then

tsql:='select Distinct mid(歌名,1,1) as p1 from 歌曲 where mid(歌名,1,1)>&quot;z&quot;
and mid(歌名,1,1)>&quot;9&quot;'
else

tsql:='select Distinct mid(歌名,1,1) as p1 from 歌曲 where 拼音缩写 like '''+fw+'%'' and mid(歌名,1,1)>&quot;z&quot;
and mid(歌名,1,1)>&quot;9&quot;';
with dm.my_quydo

begin

close;
sql.clear;
sql.add(tsql);
try
open;
first;
except
trecordcount:=0;
end;

trecordcount:=recordcount;
if trecordcount>0 then

begin

tfirstword.clear;
if (trecordcount mod 15)=0 then

p24_label.Tag :=recordcount div 15
else

p24_label.Tag :=recordcount div 15+1;
p24_label.Caption :='第1页/共'+inttostr(p24_label.tag)+'页';
result:=true;
application.ProcessMessages;
while not eofdo

begin

tfirstword.add(fieldbyname('p1').AsString) ;
//结束地
next;
end;

end;

close;
end;

end;


procedure Tnsktv.enablezs(kind:boolean);
begin

arrow4.Visible :=kind;
if kind then
k01.OnClick:=numbsqlsong_1 else
k01.OnClick:=nil;
if kind then
k02.OnClick:=numbsqlsong_1 else
k02.OnClick:=nil;
if kind then
k03.OnClick:=numbsqlsong_1 else
k03.OnClick:=nil;
if kind then
k04.OnClick:=numbsqlsong_1 else
k04.OnClick:=nil;
if kind then
k05.OnClick:=numbsqlsong_1 else
k05.OnClick:=nil;
if kind then
k06.OnClick:=numbsqlsong_1 else
k06.OnClick:=nil;
if kind then
k07.OnClick:=numbsqlsong_1 else
k07.OnClick:=nil;
if kind then
k08.OnClick:=numbsqlsong_1 else
k08.OnClick:=nil;
if kind then
k09.OnClick:=numbsqlsong_1 else
k09.OnClick:=nil;
if kind then
k0B.OnClick:=numbsqlsong_1 else
k0B.OnClick:=nil;
k01.Enabled:=kind;
k02.Enabled:=kind;
k03.Enabled:=kind;
k04.Enabled:=kind;
k05.Enabled:=kind;
k06.Enabled:=kind;
k07.Enabled:=kind;
k08.Enabled:=kind;
k09.Enabled:=kind;
k0B.Enabled:=kind;
end;


procedure Tnsktv.enablepy(kind:boolean;visual:boolean);
begin

arrow3.Visible :=visual;
if kind then
song_w_a.OnClick:=sql_word_song else
song_w_a.OnClick:=nil;
if kind then
song_w_b.OnClick:=sql_word_song else
song_w_b.OnClick:=nil;
if kind then
song_w_c.OnClick:=sql_word_song else
song_w_c.OnClick:=nil;
if kind then
song_w_d.OnClick:=sql_word_song else
song_w_d.OnClick:=nil;
if kind then
song_w_e.OnClick:=sql_word_song else
song_w_e.OnClick:=nil;
if kind then
song_w_f.OnClick:=sql_word_song else
song_w_f.OnClick:=nil;
if kind then
song_w_g.OnClick:=sql_word_song else
song_w_g.OnClick:=nil;
if kind then
song_w_h.OnClick:=sql_word_song else
song_w_h.OnClick:=nil;
if kind then
song_w_i.OnClick:=sql_word_song else
song_w_i.OnClick:=nil;
if kind then
song_w_j.OnClick:=sql_word_song else
song_w_j.OnClick:=nil;
if kind then
song_w_k.OnClick:=sql_word_song else
song_w_k.OnClick:=nil;
if kind then
song_w_l.OnClick:=sql_word_song else
song_w_l.OnClick:=nil;

if kind then
song_w_m.OnClick:=sql_word_song else
song_w_m.OnClick:=nil;
if kind then
song_w_n.OnClick:=sql_word_song else
song_w_n.OnClick:=nil;
if kind then
song_w_o_OnClick:=sql_word_song else
song_w_o_OnClick:=nil;
if kind then
song_w_p.OnClick:=sql_word_song else
song_w_p.OnClick:=nil;
if kind then
song_w_q.OnClick:=sql_word_song else
song_w_q.OnClick:=nil;
if kind then
song_w_r.OnClick:=sql_word_song else
song_w_r.OnClick:=nil;
if kind then
song_w_s.OnClick:=sql_word_song else
song_w_s.OnClick:=nil;
if kind then
song_w_t.OnClick:=sql_word_song else
song_w_t.OnClick:=nil;
if kind then
song_w_u.OnClick:=sql_word_song else
song_w_u.OnClick:=nil;
if kind then
song_w_v.OnClick:=sql_word_song else
song_w_v.OnClick:=nil;
if kind then
song_w_w.OnClick:=sql_word_song else
song_w_w.OnClick:=nil;
if kind then
song_w_x.OnClick:=sql_word_song else
song_w_x.OnClick:=nil;
if kind then
song_w_y.OnClick:=sql_word_song else
song_w_y.OnClick:=nil;
if kind then
song_w_z.OnClick:=sql_word_song else
song_w_z.OnClick:=nil;

song_w_a.Enabled:=kind;
song_w_b.Enabled:=kind;
song_w_c.Enabled:=kind;
song_w_d.Enabled:=kind;
song_w_e.Enabled:=kind;
song_w_f.Enabled:=kind;
song_w_g.Enabled:=kind;
song_w_h.Enabled:=kind;
song_w_i.Enabled:=kind;
song_w_j.Enabled:=kind;
song_w_k.Enabled:=kind;
song_w_l.Enabled:=kind;
song_w_m.Enabled:=kind;
song_w_n.Enabled:=kind;
song_w_o.Enabled:=kind;
song_w_p.Enabled:=kind;
song_w_q.Enabled:=kind;
song_w_r.Enabled:=kind;
song_w_s.Enabled:=kind;
song_w_t.Enabled:=kind;
song_w_u.Enabled:=kind;
song_w_v.Enabled:=kind;
song_w_w.Enabled:=kind;
song_w_x.Enabled:=kind;
song_w_y.Enabled:=kind;
song_w_z.Enabled:=kind;
end;


procedure enablekeydown(hWnd: HWND;
uMsg: UINT;
idEvent: UINT;
Time: DWORD);stdcall;
begin

nsktv.onKeyDown:=nsktv.FormKeyDown;
end;



function Tnsktv.sqlsong(ifshow:boolean):boolean;
//查询合条件的歌曲
var
tsql,tstr:string;
ifok:boolean;
trecordcount:integer;
tpoint:psonglist;
// nowCursor:tCursor;
begin

if sqlnow then
exit;
trecordcount:=0;
result:=false;
ifok:=false;
if iflockme=false then

begin

// screen.Cursor:=nowcursor;
showmag(' 对不起,本包箱已被管理员封闭,请向服务台请求',false);
exit ;
end;

// nowcursor:=screen.Cursor;
// screen.Cursor:=crHourGlass;

case pressit(12)+myselectpoint of
22:begin

loadpict(p90_i1,'nozs');
enablezs(false);
enablepy(true,true);
end;

24:begin

loadpict(p90_i1,'nopy');
enablezs(true);
enablepy(false,false);
end;

35:begin

loadpict(p90_i1,'nopy');
enablezs(true);
enablepy(false,false);
end;

91,11,31,34,36,0:
begin

loadpict(p90_i1,'Songlist');
enablezs(true);
enablepy(true,false);
end;

end;

SetTimer(nsktv.Handle,9,1000,@timepro.showsoundProc);
application.ProcessMessages;
//如果没有PING通,则 if_net_err=true
{
if (if_net_err)and(dm.song_conn.ConnectionString<>dm.my_locate_conn.ConnectionString) then

begin

playing_song.Clear;
//清除列表中的歌曲
myplaylist.Clear;
//清除列表中的歌曲
dm.song_conn.Close;
dm.song_conn.ConnectionString:=dm.my_locate_conn.ConnectionString ;
dm.song_conn.Open;
end
else

if (not if_net_err)and(dm.song_conn.ConnectionString=dm.my_locate_conn.ConnectionString) then

begin

inidb;
addmemo('网络断开后重新联接数据库');
end;

}
if not dm.song_conn.Connected then

begin

// screen.Cursor:=nowcursor;
showmag('对不起,系统还未联接服务器,请稍等',false);
exit;
end;


tsql:='select top 600 id,编号,歌手姓名,歌名,类别,拼音缩写,路径,声道,类型,排行,歌名字数,语种,歌手性别,(左声音大小+1) AS 左声音大小,(右声音大小+1) AS 右声音大小,';
tsql:=tsql+'(亮度+1) AS 亮度,(对比度+1) AS 对比度,(饱和度+1) AS 饱和度,(开始地+1) AS 开始地,(终止地+1) AS 终止地 from 歌曲 where ';
if mysql.song_kind<>'' then
//检查歌曲类型
begin

if length(mysql.song_kind)>8 then

tsql:=tsql+'(类别 like &quot;'+mysql.song_kind+'&quot;)'
else

tsql:=tsql+'(类别 like &quot;'+mysql.song_kind+'%&quot;)';
ifok:=true;
end;


if mysql.song_id <>'' then
//检查歌曲编号
begin

if ifok then
tsql:=tsql+' and (编号 like &quot;'+mysql.song_id +'&quot;)'
else

tsql:=tsql+'(编号 like &quot;'+mysql.song_id +'&quot;)';
ifok:=true;
end;


if mysql.player_sex<>'' then
//检查歌手性别
begin

if ifok then
tsql:=tsql+' and (歌手性别 like &quot;'+mysql.player_sex+'&quot;)'
else

tsql:=tsql+'(歌手性别 like &quot;'+mysql.player_sex+'&quot;)';
ifok:=true;
end;


if mysql.song_yz <>'' then
//检查语种
begin

if ifok then
tsql:=tsql+' and (语种=&quot;'+mysql.song_yz+'&quot;)'
else

tsql:=tsql+'(语种= &quot;'+mysql.song_yz+'&quot;)';
ifok:=true;
end;


if mysql.py_sx<>'' then
//检查歌曲的拼音缩写
begin

if ifok then
tsql:=tsql+' and (拼音缩写 like &quot;'+mysql.py_sx+'%&quot;)'
else

tsql:=tsql+'(拼音缩写 like &quot;'+mysql.py_sx+'%&quot;)';
ifok:=true;
end;


if mysql.player_name <>'' then
//检查歌手姓名
begin

if ifok then
tsql:=tsql+' and (歌手姓名 = &quot;'+mysql.player_name+'&quot;)'
else

tsql:=tsql+'(歌手姓名 = &quot;'+mysql.player_name+'&quot;)';
ifok:=true;
end;


if mysql.song_name <>'' then
//检查歌名
begin

if ifok then
tsql:=tsql+' and (歌名 like &quot;'+mysql.song_name+'%&quot;)'
else

tsql:=tsql+'(歌名 like &quot;'+mysql.song_name+'%&quot;)';
ifok:=true;
end;



if mysql.song_numb <>'' then
//检查歌名字数
begin

if mysql.song_numb='900' then

tstr:='(歌名字数 >= 10)'
else

if mysql.song_numb='999' then

tstr:='(歌名字数 >=0)'
else

tstr:='(歌名字数 = '+mysql.song_numb+')';
if ifok then

tsql:=tsql+' and '+tstr
else

tsql:=tsql+tstr;
tsql:=tsql+' order by 拼音缩写';
ifok:=true;
end;

try
if not dm.song_conn.Connected then

begin

// screen.Cursor:=nowcursor;
showmag('对不起,系统还未联接服务器,请稍等',false);
exit;
end;

except
end;

clssong;
if length(mysql.tsql)>30 then
tsql:=mysql.tsql;
with dm.songqurdo

begin

close;
sql.clear;
sql.add(tsql);
try
open;
first;
except
mysql.tsql:='';
trecordcount:=0;
end;

trecordcount:=recordcount;
if trecordcount>0 then

begin

nowplay_0.Tag:=1;
if (trecordcount mod 6)=0 then

nowshowsongpage :=recordcount div 6
else

nowshowsongpage :=recordcount div 6+1;
result:=true;
clsmysonglist;
application.ProcessMessages;
while not eofdo

begin

if songlist=nil then

begin

try
new(songlist);
songlist^.song_id :=fieldbyname('id').AsString ;
songlist^.player_name :=fieldbyname('歌手姓名').AsString ;
songlist^.song_name :=fieldbyname('歌名').AsString ;
songlist^.nextp:=nil;
except
end;

end
else

begin

try
new(tpoint);
tpoint^.song_id :=fieldbyname('id').AsString ;
tpoint^.player_name :=fieldbyname('歌手姓名').AsString ;
tpoint^.song_name :=fieldbyname('歌名').AsString ;
tpoint^.nextp :=songlist;
songlist:=tpoint;
except
end;

end;

next;
end;

//end of while
sqlnow:=false;
uppage90.Tag:=1;
//第一页标志
if ifshow then
showsong(1);
//显示第一页
end //end of if
else

if pressit(12)<>35 then

showmag('对不起,没有找到节目',false);
end;

//screen.Cursor:=nowcursor;
end;


procedure Tnsktv.showsong(how:integer);
//显示歌曲的第 HOW 页到窗口上
var
i,t:integer;
tpoint:psonglist;
new_how:integer;
if_err:boolean;
twstr:Widestring;
label showit;
begin

if sqlnow then
exit;
if how=0 then

begin

uppage90.Tag:=1;
exit;
end;

if how>nowshowsongpage then

begin

uppage90.Tag:=nowshowsongpage;
exit;
end;

try
if_err:=false;
new_how:=how;
new(tpoint);
tpoint:=songlist;
// i:=8*(how-1);
i:=6*(how-1);
try
for t:=1 to ido

tpoint:=tpoint^.nextp;
except
if_err:=true;
end;

clssong;
application.ProcessMessages;
if tpoint <>nil then

begin

if(myplaylist.Items.IndexOf(tpoint^.song_name)>-1)then

p90_l1.Caption:='★'+tpoint^.song_name+' ('+tpoint^.player_name +')' //第1首
else

p90_l1.Caption:=tpoint^.song_name+' ('+tpoint^.player_name +')';
//第1首
p90_l1.Hint:=p90_l1.Caption;
twstr:=copy(p90_l1.Caption,1,23);
p90_l1.Caption:=twstr;
p90_l1.Visible :=true;
tpoint:=tpoint^.nextp;
end
else

begin

nowplay_0.Tag:=nowplay_0.Tag-1;
new_how:=new_how-1;
showsong(nowplay_0.Tag);
goto showit;
end;


if tpoint <>nil then

begin

if(myplaylist.Items.IndexOf(tpoint^.song_name)>-1)then

p90_l2.Caption:='★'+tpoint^.song_name+' ('+tpoint^.player_name +')' //第2首
else

p90_l2.Caption:=tpoint^.song_name+' ('+tpoint^.player_name +')';
//第2首
p90_l2.Hint:=p90_l2.Caption;
twstr:=copy(p90_l2.Caption,1,23);
p90_l2.Caption:=twstr;
p90_l2.Visible :=true;
tpoint:=tpoint^.nextp;
end
else

begin

goto showit;
end;


if tpoint <>nil then

begin

if(myplaylist.Items.IndexOf(tpoint^.song_name)>-1)then

p90_l3.Caption:='★'+tpoint^.song_name+' ('+tpoint^.player_name +')' //第3首
else

p90_l3.Caption:=tpoint^.song_name+' ('+tpoint^.player_name +')';
//第3首
p90_l3.Hint:=p90_l3.Caption;
twstr:=copy(p90_l3.Caption,1,23);
p90_l3.Caption:=twstr;
p90_l3.Visible:=true;
tpoint:=tpoint^.nextp;
end
else

begin

goto showit;
end;


if tpoint <>nil then

begin

if(myplaylist.Items.IndexOf(tpoint^.song_name)>-1)then

p90_l4.Caption:='★'+tpoint^.song_name+' ('+tpoint^.player_name +')' //第4首
else

p90_l4.Caption:=tpoint^.song_name+' ('+tpoint^.player_name +')';
//第4首
p90_l4.Hint:=p90_l4.Caption;
twstr:=copy(p90_l4.Caption,1,23);
p90_l4.Caption:=twstr;
p90_l4.Visible:=true;
tpoint:=tpoint^.nextp;
end
else

begin

goto showit;
end;


if tpoint <>nil then

begin

if(myplaylist.Items.IndexOf(tpoint^.song_name)>-1)then

p90_l5.Caption:='★'+tpoint^.song_name+' ('+tpoint^.player_name +')' //第5首
else

p90_l5.Caption:=tpoint^.song_name+' ('+tpoint^.player_name +')';
//第5首
p90_l5.Hint:=p90_l5.Caption;
twstr:=copy(p90_l5.Caption,1,23);
p90_l5.Caption:=twstr;
p90_l5.Visible:=true;
tpoint:=tpoint^.nextp;
end
else

begin

goto showit;
end;


if tpoint <>nil then

begin

if(myplaylist.Items.IndexOf(tpoint^.song_name)>-1)then

p90_l6.Caption:='★'+tpoint^.song_name+' ('+tpoint^.player_name +')' //第6首
else

p90_l6.Caption:=tpoint^.song_name+' ('+tpoint^.player_name +')';
//第6首
p90_l6.Hint:=p90_l6.Caption;
twstr:=copy(p90_l6.Caption,1,23);
p90_l6.Caption:=twstr;
p90_l6.Visible:=true;
tpoint:=tpoint^.nextp;
end
else

begin

goto showit;
end;

showit:
if if_err then
showmypos_pic.Tag:=showmypos_pic.Tag-1;
p90_lp1.Caption :='第'+inttostr(new_how)+ '页/共'+inttostr(nowshowsongpage)+'页';
showok(90);
except
end;

end;



procedure Tnsktv.clsplayer();
//清除歌手列表
begin

p91_l1.Visible :=false;
//文字标签
p91_l1.Caption :='';
p91_l2.Visible :=false;
p91_l2.Caption :='';
p91_l3.Visible :=false;
p91_l3.Caption :='';
p91_l4.Visible :=false;
p91_l4.Caption :='';
p91_l5.Visible :=false;
p91_l5.Caption :='';
p91_l6.Visible :=false;
p91_l6.Caption :='';
application.ProcessMessages ;
p91_i1.Visible :=false;
//图片
p91_i2.Visible :=false;
p91_i3.Visible :=false;
p91_i4.Visible :=false;
p91_i5.Visible :=false;
p91_i6.Visible :=false;
{
p91_i7.Visible :=false;
p91_i8.Visible :=false;
}
end;


procedure Tnsktv.showplayer(how:integer);
//显示歌手的第 HOW 页到窗口上
var
i:integer;
tfilepath:string;
ifall:boolean;
label showit;
begin

ifall:=false;
clsplayer;
tfilepath:=ExtractFilePath(paramstr(0))+'pict/player/';
// i:=8*(how-1);
i:=6*(how-1);
p91_lp1.Caption :='第'+inttostr(how)+ '页--共'+inttostr(p91_lp1.Tag)+'页';
if playerlist.Count >i then

begin

if playerlist.count<1 then
exit;
p91_l1.Caption:=playerlist.Strings ;
// p91_l1.Visible :=true;
if fileexists(tfilepath+playerlist.Strings+'.bmp') then

p91_i1.Picture.LoadFromFile(tfilepath+playerlist.Strings+'.bmp')
else

begin

p91_i1.Picture:=i12.picture;
writetext(p91_i1,playerlist.Strings);
end;


p91_i1.Stretch:=true;
p91_i1.Visible :=true;
ifall:=true;
inc(i);
end
else

begin

p91.Tag:=how;
goto showit;
end;


if playerlist.Count >i then

begin

p91_l2.Caption:=playerlist.Strings ;
// p91_l2.Visible :=true;
if fileexists(tfilepath+playerlist.Strings+'.bmp') then

p91_i2.Picture.LoadFromFile(tfilepath+playerlist.Strings+'.bmp')
else

begin

p91_i2.Picture:=i12.picture;
writetext(p91_i2,playerlist.Strings);
end;

p91_i2.Stretch:=true;
p91_i2.Visible :=true;
ifall:=true;
inc(i);
end
else

begin

p91.Tag:=how;
goto showit;
end;



if playerlist.Count >i then

begin

p91_l3.Caption:=playerlist.Strings ;
// p91_l3.Visible:=true;
if fileexists(tfilepath+playerlist.Strings+'.bmp') then

p91_i3.Picture.LoadFromFile(tfilepath+playerlist.Strings+'.bmp')
else

begin

p91_i3.Picture:=i12.picture;
writetext(p91_i3,playerlist.Strings);
end;


p91_i3.Stretch:=true;
p91_i3.Visible :=true;
ifall:=true;
inc(i);
end
else

begin

p91.Tag:=how;
goto showit;
end;


if playerlist.Count >i then

begin

p91_l4.Caption:=playerlist.Strings ;
// p91_l4.Visible:=true;
if fileexists(tfilepath+playerlist.Strings+'.bmp') then

p91_i4.Picture.LoadFromFile(tfilepath+playerlist.Strings+'.bmp')
else

begin

p91_i4.Picture:=i12.picture;
writetext(p91_i4,playerlist.Strings);
end;


p91_i4.Stretch:=true;
p91_i4.Visible :=true;
ifall:=true;
inc(i);
end
else

begin

p91.Tag:=how;
goto showit;
end;




if playerlist.Count >i then

begin

p91_l5.Caption:=playerlist.Strings ;
// p91_l5.Visible:=true;
if fileexists(tfilepath+playerlist.Strings+'.bmp') then

p91_i5.Picture.LoadFromFile(tfilepath+playerlist.Strings+'.bmp')
else

begin

p91_i5.Picture:=i12.picture;
writetext(p91_i5,playerlist.Strings);
end;


p91_i5.Stretch:=true;
p91_i5.Visible :=true;
ifall:=true;
inc(i);
end
else

begin

p91.Tag:=how;
goto showit;
end;


if playerlist.Count >i then

begin

p91_l6.Caption:=playerlist.Strings ;
// p91_l6.Visible:=true;
if fileexists(tfilepath+playerlist.Strings+'.bmp') then

p91_i6.Picture.LoadFromFile(tfilepath+playerlist.Strings+'.bmp')
else

begin

p91_i6.Picture:=i12.picture;
writetext(p91_i6,playerlist.Strings);
end;


p91_i6.Stretch:=true;
p91_i6.Visible :=true;
ifall:=true;
inc(i);
end
else

begin

p91.Tag:=how;
goto showit;
end;


{


if playerlist.Count >i then

begin

p91_l7.Caption:=playerlist.Strings ;
p91_l7.Visible:=true;
if fileexists(tfilepath+playerlist.Strings+'.bmp') then

p91_i7.Picture.LoadFromFile(tfilepath+playerlist.Strings+'.bmp')
else

p91_i7.Picture:=i12.picture;

p91_i7.Stretch:=true;
p91_i7.Visible :=true;
ifall:=true;
inc(i);
end
else

begin

p91.Tag:=0;
goto showit;
end;




if playerlist.Count >i then

begin

p91_l8.Caption:=playerlist.Strings ;
p91_l8.Visible:=true;
if fileexists(tfilepath+playerlist.Strings+'.bmp') then

p91_i8.Picture.LoadFromFile(tfilepath+playerlist.Strings+'.bmp')
else

p91_i8.Picture:=i12.picture;

p91_i8.Stretch:=true;
p91_i8.Visible :=true;
ifall:=true;
inc(i);
end
else

begin

p91.Tag:=0;
goto showit;
end;

}
showit:
begin

if ifall then

begin

showok(91);
end
else

showplayer(how-1);
end;

end;





function Tnsktv.sqlplayer:boolean;
var
tsql:string;
trecordcount:integer;
begin

result:=false;
if iflockme=false then

begin

if ghMPEGStream<>0 then

begin

closedrv(ghMPEGStream);
ghMPEGStream:=0;
end;


// showmag('对不起,本包箱已被管理员封闭');
exit ;
end;


tsql:='select * from 歌手 where ';
if mysql.song_kind <>'' then
//检查歌手性质
tsql:=tsql+'(歌手性质 like &quot;%'+mysql.song_kind+'%&quot;)'
else

if mysql.player_sex<>'' then

tsql:=tsql+'(歌手性质 like &quot;%'+mysql.player_sex+'&quot;)'
else

tsql:=tsql+'(歌手性质 like &quot;%&quot;)';
if mysql.player_name_sx<>'' then
//检查歌手姓名拼音
tsql:=tsql+' and (歌手缩写 like &quot;'+mysql.player_name_sx+'%&quot;)';
tsql:=tsql+' order by 歌手缩写';
if not dm.song_conn.Connected then

begin

showmag('对不起,系统还未联接服务器,请稍等',false);
exit;
end;

try
with dm.songqurdo

begin

close;
sql.clear;
sql.add(tsql);
try
open;
first;
trecordcount:=recordcount;
except
trecordcount:=0;
end;

if trecordcount>0 then

begin

result:=true;
playerlist.Clear;
if (dm.songqur.recordcount div 6)<>0 then

if(dm.songqur.recordcount mod 6)=0 then

p91_lp1.tag:=(dm.songqur.recordcount div 6)
else

p91_lp1.tag:=(dm.songqur.recordcount div 6)+1
else

p91_lp1.tag:=(dm.songqur.recordcount div 6)+1;
if p91_lp1.Tag=0 then
p91_lp1.Tag:=1;
application.ProcessMessages;
while not eofdo

begin

playerlist.Add(fieldbyname('歌手姓名').AsString) ;
next;
end;

//end of while
showplayer(1);
p91.Tag :=1;
end //end of if
// else

// showmag('没有找到记录');
end;

except
end;

end;





procedure Tnsktv.select34(key:word);
//根据语种选
var
tstr:string;
trad:integer;
begin

Randomize;
tstr:=inttostr(pressit(12));
if commandlist.Count=0 then

commandlist.Add(tstr)
else

if commandlist.Strings[commandlist.Count-1]<>tstr then
commandlist.Add(tstr);
if mysql.song_kind='' then
mysql.song_kind:='%';
if length(mysql.song_kind)>8 then
mysql.song_kind:=copy(mysql.song_kind,1,8);
trad:=Random(strtoint(formatdatetime('s',now)));
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
1031:begin
//1 国语
{
oldcolor:=p34_l1.font.Color;
p34_l1.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p34_l1.font.Color :=oldcolor;
}
mysql.song_yz:='国语';
end;

1032:begin
//2 粤语
{
oldcolor:=p34_l2.font.Color;
p34_l2.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p34_l2.font.Color :=oldcolor;
}
mysql.song_yz:='粤语';
end;

1033:begin
//3 英语
{
oldcolor:=p34_l3.font.Color;
p34_l3.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p34_l3.font.Color :=oldcolor;
}
mysql.song_yz:='台语';
end;

1034:begin
//4 日语
{
oldcolor:=p34_l4.font.Color;
p34_l4.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p34_l4.font.Color :=oldcolor;
}
mysql.song_yz:='其它';
end;

1035:begin
//4 韩国语
{
oldcolor:=p34_l5.font.Color;
p34_l5.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p34_l5.font.Color :=oldcolor;
}
// mysql.song_yz:='其它';
end;

1030:begin
//0 返回
returnone;
exit;
end;

else

exit;
end;

sqlsong(true);
end;


function Tnsktv.loadpict(myload:timage;pictname:string):boolean;
//装载图片
begin

result:=true;
try
if not fileexists(ExtractFilePath(paramstr(0))+'/PICT/SKIN/'+pictname+'.bmp') then

myload.Picture.LoadFromFile(ExtractFilePath(paramstr(0))+'/PICT/SKIN/'+pictname+'.jpg')
else

if fileexists(ExtractFilePath(paramstr(0))+'/PICT/SKIN/'+pictname+'.bmp') then
myload.Picture.LoadFromFile(ExtractFilePath(paramstr(0))+'/PICT/SKIN/'+pictname+'.bmp')
else
result:=false;
except
result:=false;
end;

end;



procedure Tnsktv.select35(key:word);
procedure showpy(how:integer);
begin

p35_lA.Visible :=false;
p35_lB.Visible :=false;
case how+myselectpoint of
1:begin

loadpict(p35_i1,'py1');
end;

2:begin

loadpict(p35_i1,'py2');
end;

3:begin

loadpict(p35_i1,'py3');
p35_lA.Visible :=true;
p35_lB.Visible :=true;
end;

end;

end;


var
tstr:string;
tint,tint2:integer;
trad:integer;
begin

Randomize;
tstr:=inttostr(pressit(12));
if commandlist.Count=0 then

commandlist.Add(tstr)
else

if commandlist.Strings[commandlist.Count-1]<>tstr then
commandlist.Add(tstr);
clsmysql;
// tint2:=howit(tint,true);
begin

trad:=Random(strtoint(formatdatetime('s',now)));
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
1031:
case py_pagenumb+myselectpoint of
1:edit1.Text:=edit1.Text+'A';
2:edit1.Text:=edit1.Text+'I';
3:edit1.Text:=edit1.Text+'Q';
end;

1032:begin

case py_pagenumb+myselectpoint of
1:edit1.Text:=edit1.Text+'B';
2:edit1.Text:=edit1.Text+'J';
3:edit1.Text:=edit1.Text+'R';
end;

end;

1033:
case py_pagenumb+myselectpoint of
1:edit1.Text:=edit1.Text+'C';
2:edit1.Text:=edit1.Text+'K';
3:edit1.Text:=edit1.Text+'S';
end;

1034:
case py_pagenumb+myselectpoint of
1:edit1.Text:=edit1.Text+'D';
2:edit1.Text:=edit1.Text+'L';
3:edit1.Text:=edit1.Text+'T';
end;

1035:
case py_pagenumb+myselectpoint of
1:edit1.Text:=edit1.Text+'E';
2:edit1.Text:=edit1.Text+'M';
3:edit1.Text:=edit1.Text+'U';
end;

1036:
case py_pagenumb+myselectpoint of
1:edit1.Text:=edit1.Text+'F';
2:edit1.Text:=edit1.Text+'N';
3:edit1.Text:=edit1.Text+'V';
end;

1037:
case py_pagenumb+myselectpoint of
1:edit1.Text:=edit1.Text+'G';
2:edit1.Text:=edit1.Text+'O';
3:edit1.Text:=edit1.Text+'W';
end;

1038:
case py_pagenumb+myselectpoint of
1:edit1.Text:=edit1.Text+'H';
2:edit1.Text:=edit1.Text+'P';
3:edit1.Text:=edit1.Text+'X';
end;

1039:begin
//9
if py_pagenumb=3 then
edit1.Text:=edit1.Text+'Y';
end;

1030:begin
//0
if py_pagenumb=3 then
edit1.Text:=edit1.Text+'Z';
end;

$3A:begin
// 歌曲列表上一页
if py_pagenumb<=1 then

begin

py_pagenumb:=1;
exit;
end;

py_pagenumb:=py_pagenumb-1;
showpy(py_pagenumb)
end;

$3B:begin
// 歌曲列表下一页
if py_pagenumb>=3 then

begin

py_pagenumb:=3;
exit;
end;

py_pagenumb:=py_pagenumb+1;
showpy(py_pagenumb)
end;

$3C:begin
//0 清除
if edit1.text='' then

begin

clsmysql;
returnone;
exit;
end;

edit1.text:=copy(edit1.text,1,length(edit1.text)-1);
end;

$3D:begin

if edit1.text='' then
exit;
if lowercase(edit1.text)='dddabc' then

begin

close;
exit;
end;

mysql.py_sx:=edit1.text;
if sqlsong(true) then

begin

// edit1.Text :='';
if commandlist.Count=0 then

commandlist.Add(tstr)
else

if commandlist.Strings[commandlist.Count-1]<>'35' then
commandlist.Add(tstr);
end
else

edit1.Text:=copy(edit1.Text,1,length(edit1.Text)-1);
end;

end;

end;

my_enter_py.Caption :=edit1.text;
end;



procedure Tnsktv.delmemo(erron:string);
begin

if erron='' then
exit;
if (dm.my_locate_conn.Connected) then

with dm.locate_quydo

begin

close;
sql.Clear;
sql.Add('delete from errorsong where id='+erron);
execsql;
close;
sql.clear;
errid:='';
end;

end;



function Tnsktv.addmemo(appmessage:string):string;
var
re:integer;
begin

if (dm.my_locate_conn.Connected) then

with dm.locate_quydo

begin

close;
sql.Clear;
sql.add('select * from errorsong where id=-1');
open;
append;

fieldbyname('songmessage').asstring:=appmessage;
post;
re:=fieldbyname('id').AsInteger ;
result:=inttostr(re);
close;
sql.clear;
end;

end;

{
procedure Tnsktv.addmemo(appmessage:string);
var
F1: TextFile;
begin

AssignFile(F1, ExtractFilePath(paramstr(0))+'msg.txt');
if fileexists(ExtractFilePath(paramstr(0))+'msg.txt') then

append(f1)
else

Rewrite(F1);
Write(F1,formatdatetime('yy-m-d-h:m:s',now)+':'+appmessage+#13+#10);
CloseFile(F1);
end;

}


procedure Tnsktv.select36(key:word);
//根据戏曲选
var
tstr:string;
trad:integer;
begin

Randomize;
tstr:=inttostr(pressit(12));
if commandlist.Count=0 then

commandlist.Add(tstr)
else

if commandlist.Strings[commandlist.Count-1]<>tstr then
commandlist.Add(tstr);
trad:=Random(strtoint(formatdatetime('s',now)));
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
1031:begin
//1 京剧
{
oldcolor:=p36_l1.font.Color;
p36_l1.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p36_l1.font.Color :=oldcolor;
} clsmysql;
mysql.song_kind:='戏曲-京剧';
// mysql.song_id:='101021%';
end;


1032:begin
//2 黄梅戏
{
oldcolor:=p36_l3.font.Color;
p36_l3.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p36_l3.font.Color :=oldcolor;
} clsmysql;
// mysql.song_id:='101023%';
mysql.song_kind:='戏曲-黄梅戏';
end;

1033:begin
//4 花鼓戏
{
oldcolor:=p36_l4.font.Color;
p36_l4.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p36_l4.font.Color :=oldcolor;
}
clsmysql;
mysql.song_kind:='戏曲-花鼓戏';
end;

1034:begin
//5 其它戏曲
{
oldcolor:=p36_l5.font.Color;
p36_l5.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p36_l5.font.Color :=oldcolor;
} clsmysql;
mysql.song_kind:='戏曲-其它';
//mysql.song_id :='101024%';
end;

1030:begin
//0 返回
clsmysql;
returnone;
exit;
end;

else

exit;
end;

sqlsong(true);
end;






procedure Tnsktv.select90(key:word);
var
tstr:string;
tpoint:psonglist;
lTime :TDateTime;
oldcolor,newcolor:tcolor;
trad:integer;
begin

Randomize;
lTime:=GetTickCount;
newcolor:=$0080FF80;
trad:=Random(strtoint(formatdatetime('s',now)));
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
1031:begin
//1 第一首
if p90_l1.Visible then
tstr:=trim(p90_l1.hint) //copy(p90_l1.Caption,4,length(p90_l1.Caption)-3);
else
exit;
oldcolor:=p90_l1.font.Color;
if pos('★',tstr)=0 then

p90_l1.Caption:='★'+trim(p90_l1.hint)
else

tstr:=copy(tstr,3,length(tstr));
p90_l1.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p90_l1.font.Color :=oldcolor;
end;

1032:begin
//2 第二首
if p90_l2.Visible then
tstr:=trim(p90_l2.hint) //copy(p90_l2.Caption,4,length(p90_l2.Caption)-3);
else
exit;
oldcolor:=p90_l2.font.Color;
if pos('★',tstr)=0 then

p90_l2.Caption:='★'+trim(p90_l2.hint)
else

tstr:=copy(tstr,3,length(tstr));
p90_l2.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p90_l2.font.Color :=oldcolor;

end;

1033:begin
//3 第三首
if p90_l3.Visible then
tstr:=trim(p90_l3.hint) //copy(p90_l3.Caption,4,length(p90_l3.Caption)-3);
else
exit;
oldcolor:=p90_l3.font.Color;
if pos('★',tstr)=0 then

p90_l3.Caption:='★'+trim(p90_l3.hint)
else

tstr:=copy(tstr,3,length(tstr));
p90_l3.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p90_l3.font.Color :=oldcolor;

end;

1034:begin
//4 第四首
if p90_l4.Visible then
tstr:=trim(p90_l4.hint) //copy(p90_l4.Caption,4,length(p90_l4.Caption)-3);
else
exit;
if not p90_l4.Visible then
exit;
oldcolor:=p90_l4.font.Color;
if pos('★',tstr)=0 then

p90_l4.Caption:='★'+trim(p90_l4.hint)
else

tstr:=copy(tstr,3,length(tstr));
p90_l4.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p90_l4.font.Color :=oldcolor;
{
tstr:='';

showmag(#13+' 这是演示版,演示版只能点播'+#13+#13+
'前三个节目,请购买正式版',true);
}
end;

1035:begin
//5 第五首
if p90_l5.Visible then
tstr:=trim(p90_l5.hint) //copy(p90_l4.Caption,4,length(p90_l4.Caption)-3);
else
exit;
if not p90_l5.Visible then
exit;
oldcolor:=p90_l5.font.Color;
if pos('★',tstr)=0 then

p90_l5.Caption:='★'+trim(p90_l5.hint)
else

tstr:=copy(tstr,3,length(tstr));
p90_l5.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p90_l5.font.Color :=oldcolor;
{
tstr:='';
showmag(#13+' 这是演示版,演示版只能点播'+#13+#13+
'前三个节目,请购买正式版',true);
}
end;

1036:begin
//6 第六首
if p90_l6.Visible then
tstr:=trim(p90_l6.hint) //copy(p90_l4.Caption,4,length(p90_l4.Caption)-3);
else
exit;
if not p90_l6.Visible then
exit;
oldcolor:=p90_l6.font.Color;
if pos('★',tstr)=0 then

p90_l6.Caption:='★'+trim(p90_l6.hint)
else

tstr:=copy(tstr,3,length(tstr));
p90_l6.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p90_l6.font.Color :=oldcolor;
{
tstr:='';
showmag(#13+' 这是演示版,演示版只能点播'+#13+#13+
'前三个节目,请购买正式版',true);
}
end;


1039:begin
//9 下一页
uppage90.Tag:=uppage90.tag+1;
showsong(uppage90.Tag);
end;

1030:begin
//0 上一页
if uppage90.Tag<=1 then
exit;
uppage90.Tag:=uppage90.tag-1;
showsong(uppage90.Tag);
end;

else

exit;
end;

if iflockme=false then

begin

// screen.Cursor:=nowcursor;
// showmag(' 对不起,本包箱已被管理员封闭,请向服务台请求');
exit ;
end;

if tstr<>'' then

begin

new(tpoint);
tpoint:=seachsong(songlist,tstr);
application.ProcessMessages;
if tpoint<>nil then
//如果找到则
begin
//判断是否为DVD,如果是判断是否已下载到本地,如果是则直接写路径
// tstr:=tpoint^.player_name+' 歌名:'+tpoint^.song_name +' 路径:'+tpoint^.song_path+' 声道:'+tpoint^.song_sound_path;
// tstr:=tstr+' 类型:'+(inttostr(tpoint^.play_type));
// tstr:=tstr+' 左音量:'+(tpoint^.vol_l);
// tstr:=tstr+' 右音量:'+(tpoint^.vol_r);
// tstr:=tstr+' 亮度:'+(tpoint^.brightness);
// tstr:=tstr+' 对比度:'+(tpoint^.contrast);
// tstr:=tstr+' 饱和度:'+(tpoint^.saturation);
// tstr:=tstr+' 开始地:'+(tpoint^.begin
f) ;
// tstr:=tstr+' 结束地:'+(tpoint^.endf);
tstr:=tpoint^.song_id+' 歌手名:'+tpoint^.player_name+' 歌名:'+tpoint^.song_name;
playing_song.Add(tstr);
// application.ProcessMessages;
with dm.my_quydo

begin

close;
sql.clear;
sql.Add('update 歌曲 set 排行=排行+1 where id='+tpoint^.song_id);
execsql;
// application.ProcessMessages;
close;
end;

myplaylist.Items.Add(tpoint^.song_name);
selectchang;
end;

//end of if tstr<>'' then

end;

end;


procedure Tnsktv.select91(key:word);
var
tstr:string;
lTime :TDateTime;
oldcolor,newcolor:tcolor;
trad:integer;
begin

Randomize;
mysql.song_kind:='';
tstr:=inttostr(pressit(12));
if commandlist.Count=0 then

commandlist.Add(tstr)
else

if commandlist.Strings[commandlist.Count-1]<>tstr then
commandlist.Add(tstr);
lTime:=GetTickCount;
newcolor:=$008000FF;
trad:=Random(strtoint(formatdatetime('s',now)));
mysql.py_sx:='';
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
1031:begin

oldcolor:=p91_l1.font.Color;
p91_l1.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p91_l1.font.Color :=oldcolor;
if p91_l1.Caption<>'' then

// if p91_l1.Visible then

begin

mysql.player_name:=p91_l1.Caption;
// mysql.player_name:=copy(p91_l1.Caption,4,length(p91_l1.Caption)-3);
end;

end;

1032:begin

oldcolor:=p91_l2.font.Color;
p91_l2.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p91_l2.font.Color :=oldcolor;
if p91_l2.Caption<>'' then

begin

mysql.player_name:=p91_l2.Caption;
//mysql.player_name:=copy(p91_l2.Caption,4,length(p91_l2.Caption)-3);
end;

end;

1033:begin

oldcolor:=p91_l3.font.Color;
p91_l3.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p91_l3.font.Color :=oldcolor;
if p91_l3.Caption<>'' then

begin

mysql.player_name:=p91_l3.Caption;
// mysql.player_name:=copy(p91_l3.Caption,4,length(p91_l3.Caption)-3);
end;

end;

1034:begin

oldcolor:=p91_l4.font.Color;
p91_l4.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p91_l4.font.Color :=oldcolor;
if p91_l4.Caption<>'' then

begin

mysql.player_name:=p91_l4.Caption;
// mysql.player_name:=copy(p91_l4.Caption,4,length(p91_l4.Caption)-3);
end;

end;

1035:begin

oldcolor:=p91_l5.font.Color;
p91_l5.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p91_l5.font.Color :=oldcolor;
if p91_l5.Caption<>'' then

begin


mysql.player_name:=p91_l5.Caption;
// mysql.player_name:=copy(p91_l5.Caption,4,length(p91_l5.Caption)-3);
end;

end;

1036:begin

oldcolor:=p91_l6.font.Color;
p91_l6.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p91_l6.font.Color :=oldcolor;
if p91_l6.Caption<>'' then

begin

mysql.player_name:=p91_l6.Caption;
end;

end;


1037:begin

man_playClick(nil);
end;

1038:begin

woman_playClick(nil);
end;

1039:begin

all_playerClick(nil);
end;

$3A:begin
//下一页
p91.Tag:=p91.Tag+1;
showplayer(p91.Tag);
exit;
end;

1030:begin
//上一页
Clsmysql;
//清除上次的查询条件
if not p91_i1.Visible then
exit;

if p91.Tag<=1 then

begin

p91.Tag:=1;
exit;
end;

p91.Tag:=p91.Tag-1;
showplayer(p91.Tag);
exit;
end;

$3B:begin
//返回
if return91.tag=1 then

begin

return91.tag:=0;
commandlist.clear;
showok(0);
end
else

begin

p91.tag:=0;
returnone;
exit;
end;


end;

else

exit;
end;

if mysql.player_name<>'' then
sqlsong(true);
end;



procedure Tnsktv.select92(key:word);
var
tstr:string;
lTime :TDateTime;
oldcolor,newcolor:tcolor;
trad:integer;
begin

Randomize;
tstr:=inttostr(pressit(12));
if commandlist.Count=0 then

commandlist.Add(tstr)
else

if commandlist.Strings[commandlist.Count-1]<>tstr then
commandlist.Add(tstr);
lTime:=GetTickCount;
newcolor:=$008000FF;
trad:=Random(strtoint(formatdatetime('s',now)));
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
1031:begin

oldcolor:=p91_l1.font.Color;
p91_l1.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p91_l1.font.Color :=oldcolor;
if p91_l1.Visible then

begin

mysql.song_kind:='舞蹈金曲的士';
end;

end;

1032:begin

oldcolor:=p91_l2.font.Color;
p91_l2.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
;
p91_l2.font.Color :=oldcolor;
if p91_l2.Visible then

begin

mysql.song_kind:='舞蹈金曲舞曲';
end;

end;

else

exit;
end;

if mysql.song_kind <>'' then
sqlsong(true);
end;



procedure Tnsktv.select102(key:word);
var
tint1,tint2:integer;
tstr1,tstr2:string;
tint:integer;
mypos,allpos:dword;
ifpause:boolean;
myvol_l,myvol_r,myvol:integer;
trad:integer;
begin

Randomize;
trad:=Random(strtoint(formatdatetime('s',now)));
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
1031:begin

if ifdisplaydemo then
exit;
try
myvol_l:=0;
myvol_r:=0;
tmyvol:=tmyvol+0.05;
myvol_l:=round(pmyvol_l*tmyvol);
//低字为左声道
myvol_r:=round(pmyvol_r*tmyvol);
//高字为右声道
if myvol_r>pmyvol_r then
myvol_r:=pmyvol_r;
if myvol_l>pmyvol_l then
myvol_l:=pmyvol_l;
if myvol_l>=pmyvol_l then
tmyvol:=1;
loadpict(showmypos_pic,'音大');
showmypos.Visible :=true;
SetTimer(nsktv.Handle,9,1000,@timepro.showsoundProc);
change_volume(ghMPEGStream,myvol_l,myvol_l);
except
end;

end;

1032:begin

if ifdisplaydemo then
exit;
try
tmyvol:=tmyvol-0.05;
if tmyvol<0 then
tmyvol:=0;
myvol_l:=round(pmyvol_l*tmyvol);
//低字为左声道
myvol_r:=round(pmyvol_r*tmyvol);
//高字为右声道
if myvol_r<0 then
myvol_r:=0;
if myvol_l<0 then
myvol_l:=0;
if myvol_l>100 then
myvol_l:=100;

loadpict(showmypos_pic,'音小');
showmypos.Visible :=true;
SetTimer(nsktv.Handle,9,1000,@timepro.showsoundProc);
change_volume(ghMPEGStream,myvol_l,myvol_l);
except
end;

end;

1033:begin

if ifdisplaydemo then
exit;
try
mysongpath:=true;
loadpict(showmypos_pic,'原唱');
showstate('_1_',true);
showmypos.Visible :=true;
SetTimer(nsktv.Handle,9,1000,@timepro.showsoundProc);
if tdbsongpath =1 then

AudioTrack(ghMPEGStream,2) //3
else

AudioTrack(ghMPEGStream,1);
//2
except
end;

end;

1034:begin

if ifdisplaydemo then
exit;
try
mysongpath:=false;
loadpict(showmypos_pic,'伴唱');
showstate('_2_',true);
showmypos.Visible :=true;

SetTimer(nsktv.Handle,9,1000,@timepro.showsoundProc);
if tdbsongpath =1 then

AudioTrack(ghMPEGStream,1) //2
else

AudioTrack(ghMPEGStream,2) //3
except
end;

end;

1035:begin

if ifdisplaydemo then
exit;
try
loadpict(showmypos_pic,'快退');
showmypos.Visible :=true;
SetTimer(nsktv.Handle,9,1000,@timepro.showsoundProc);
prev(ghMPEGStream);
except
end;

end;

1036:begin

if ifdisplaydemo then
exit;
try
loadpict(showmypos_pic,'快进');
showmypos.Visible :=true;
SetTimer(nsktv.Handle,9,1000,@timepro.showsoundProc);
step(ghMPEGStream);
except
end;

end;

1037:begin

if ifdisplaydemo then
exit;
try
if GetState(ghMPEGStream)=0 then
//如果已暂停
begin

ifpause:=false;
loadpict(showmypos_pic,'暂停');
showstate('_3_',false);
end
else

begin

ifpause:=true;
showstate('_3_',true);
end;

if not ifpause then

Resumeplay(ghMPEGStream)
else

pause(ghMPEGStream);
except
end;

end;

1038:begin

if ifdisplaydemo then
exit;
try
if (playing_song.count>0) then

begin

loadpict(showmypos_pic,'停唱');
showmypos.Visible :=true;
SetTimer(nsktv.Handle,9,1000,@timepro.showsoundProc);
end
else

begin

showmag('您没有选择节目',false);
end;

if (ghMPEGStream<>0) then

begin

change_volume(ghMPEGStream,0,0);
closestream( ghMPEGStream );
ghMPEGStream := 0;
delmemo(errid);
exit;
end;

except
end;

end;

1039:begin

if ifdisplaydemo then
exit;
try
loadpict(showmypos_pic,'重播');
showmypos.Visible :=true;
SetTimer(nsktv.Handle,9,1000,@timepro.showsoundProc);
if ghMPEGStream=0 then

begin

if currsong='' then
exit;
playing_song.Insert(0,currsong);
tint1:=pos(' 路径:', currsong)+7;
tint2:=pos(' 声道:', currsong)+7;
tstr1:=copy(currsong,tint1,length(currsong)-tint1-7);
myplaylist.Items.Insert(0,trim(copy(currsong,pos(' 歌名:',currsong)+6,pos(' 路径:',currsong)-pos(' 歌名:',currsong)-5)));
p102_l3Click(nil);
selectchang;
end
else

replayme(ghMPEGStream)
except
end;

end;

1030:begin
//返回
try
returnone;
exit;
except
end;

end;

$3A:begin
//删除
//0:无操作 1:删除 2:优先
if_del_pre:=1;
end;

$3B:begin
//优先
//0:无操作 1:删除 2:优先
if_del_pre:=2
end;

$3C:begin

if_del_pre:=1;
loadpict(p21_i1,'del');
showok(21);
end;

$3D:begin

loadpict(p21_i1,'word_numb1');
if_del_pre:=2;
showok(21);
end;

$3E:begin
//向上翻
if myplaylist.ItemIndex>3 then

myplaylist.ItemIndex:=myplaylist.ItemIndex-4
else

if myplaylist.ItemIndex>0 then
myplaylist.ItemIndex:=myplaylist.ItemIndex-1
else

myplaylist.ItemIndex:=0;
end;

$3F:begin
//向下翻
if (myplaylist.ItemIndex+4)<myplaylist.Items.Count then

myplaylist.ItemIndex:=myplaylist.ItemIndex+4
else

if myplaylist.ItemIndex<myplaylist.Items.Count then

myplaylist.ItemIndex:=myplaylist.ItemIndex+1
else

myplaylist.ItemIndex:=myplaylist.Items.Count-1;
end;

end;

end;



procedure Tnsktv.select93(key:word);
var
tstr:string;

trad:integer;
begin

Randomize;
tstr:=inttostr(pressit(12));
if commandlist.Count=0 then

commandlist.Add(tstr)
else

if commandlist.Strings[commandlist.Count-1]<>tstr then
commandlist.Add(tstr);
// begin

trad:=Random(strtoint(formatdatetime('s',now)));
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
1031:begin
//1 呼叫总台
try
{
tstr:='G'+ComputerName+'呼叫总台';
sendmag(tstr,allip);
showmag('已呼叫总台,请稍等。。。');
application.ProcessMessages ;
}
P93_box1.Tag:=1;
P93_box1.Clear;
P93_box1.Items.Add('机器故障,请检修');
P93_box1.Items.Add('请求茶水');
P93_box1.Items.Add('请求服务帮助');

except
end;

end;

1032:begin
//2 查看小姐
try
if not dm.newquy.Connection.Connected then
exit;
with dm.newquydo

begin

close;
sql.Clear ;
sql.Add('select * from 小姐');
open;
first;
P93_box1.Clear ;
P93_box1.Tag:=2;
while not eofdo

begin

P93_box1.Items.Add(fieldbyname('姓名').AsString +' 坐台费:'+ fieldbyname('价格').AsString+'元/小时');
next;
end;

end;

except
end;

end;

1033:begin
//3 酒水服务
try
if not dm.newquy.Connection.Connected then
exit;
with dm.newquydo

begin

close;
sql.Clear ;
sql.Add('select * from 酒水');
open;
first;
P93_box1.Clear ;
P93_box1.Tag:=3;
while not eofdo

begin

P93_box1.Items.Add(fieldbyname('名称').AsString +' 价格:'+fieldbyname('价格').AsString+'元/'+fieldbyname('单位').AsString);
next;
end;

end;

except
end;

end;

1034:begin

try
if messagebox(0,' >>火警警报<<'+#13+#13+
' 您即将向服务总台发出火警警报,如果您的包箱'+#13+
'发生火险请立即发送.','>>火警警报<<',
mb_yesno+mb_iconinformation+mb_systemmodal)<>id_yes then
exit;
P93_box1.Tag:=1;
tstr:='G'+myname+'发生火险,请援助';
sendmag(tstr,allip);
showmag('已发出火险警报,请立即离开火场.',true);
application.ProcessMessages;
except
end;

end;

1035:begin

try
tstr:='Q'+myname;
sendmag(tstr,allip);
application.ProcessMessages;
except
end;

end;

1037:begin
//7 向上 上一项
try
if P93_box1.Count<0 then
exit;
if p93_box1.ItemIndex=0 then

P93_box1.ItemIndex:=P93_box1.count-1
else

P93_box1.ItemIndex:=P93_box1.ItemIndex-1;
except
end;

end;

1038:begin
//8 向下 下一项
try
if P93_box1.Count<0 then
exit;
if p93_box1.ItemIndex=P93_box1.count-1 then

P93_box1.ItemIndex:=0
else

P93_box1.ItemIndex:=P93_box1.ItemIndex+1;
except
end;

end;

1039:begin
//9 选中
try
if P93_box1.ItemIndex <0 then
exit;
case P93_box1.Tag+myselectpoint of
1:begin

tstr:='G'+myname+' '+P93_box1.Items.Strings[P93_box1.itemindex];
sendmag(tstr,allip);
end;

2:begin

tstr:='W'+myname+' 需要小姐:'+P93_box1.Items.Strings[P93_box1.itemindex];
sendmag(tstr,allip);
showmag('已向总台呼叫小姐,请稍等。。。',false);
end;


3:begin

tstr:='S'+myname+' 需要酒水:'+P93_box1.Items.Strings[P93_box1.itemindex] ;
sendmag(tstr,allip);
showmag('已向总台呼叫酒水服务,请稍等。。。',false);
end;

end;

except
end;

end;

1030:begin
//0 返回
returnone;
end;

else
begin

exit;
end;

end;

end;



function seachsong(h:psonglist;tname:string):psonglist;
//从songlist列表中找出下一首歌
var
tpoint:psonglist;
begin

result:=nil;
if h=nil then
exit;
new(tpoint);
tpoint:=songlist;
while not (tpoint=nil)do

if not (tpoint^.song_name+' ('+tpoint^.player_name+')'=tname) then

begin

tpoint:=tpoint^.nextp;
end
else

begin

result:=tpoint;
exit;
end;

end;



procedure Tnsktv.returnone;
var i:integer;
begin

i:=0;
try
if commandlist.Count>0 then

begin

i:=StrToIntDef(commandlist.Strings[commandlist.Count-1],0);
while (commandlist.Count>0)and(i=pressit(12))do

begin

i:=StrToIntDef(commandlist.Strings[commandlist.Count-1],0);
commandlist.Delete(commandlist.Count-1);
end;

if commandlist.Count>0 then
commandlist.Delete(commandlist.Count-1);
showok(i);
exit;
end
else

begin

if not p00.Visible then

begin

showok(0);
end;

exit;
end;

except
showok(0);
end;

end;



procedure Tnsktv.allselect(Key: Word);
VAR
tstr:string;
tint1:integer;
trad:integer;
begin

Randomize;
trad:=Random(strtoint(formatdatetime('s',now)));
case key+myselectpoint*(ord(trad)-ord(trad-1)) of
lm_exit:begin

close;
end;

lm_NextSong:begin
//N 下一曲
{
oldcolor:=p102_l3.font.Color;
p102_l3.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
p102_l3.font.Color :=oldcolor;
}
select102(1038);
end;

lm_Channel_1:begin
// 原声
select102(1033);
end;


lm_channel_2:begin

select102(1034);
end;

lm_replay:begin
//重播
select102(1039);
end;

lm_Pause:select102(1037);
//C 暂停

lm_Volup:begin
//V 加大音量
select102(1031);
end;

lm_Voldown:begin
//O 减少音量
select102(1032);
end;

lm_menu:begin

Clsmysql;
//清除上次的查询条件
edit1.text :='';
my_enter_py.Caption :='';
nowplay_0.Tag:=1;
p0_l6.tag:=0;
p91_lp1.tag:=1;
commandlist.Clear;
//ESC 返回
showok(0);
end;

lm_Priority:begin
//R 优先
pre_songClick(nil);
end;

lm_Del:begin
//E 删除
case pressit(1)+myselectpoint of
35:select35($3C);
21:del_songClick(nil);
end;

end;

lm_Return:begin
//要改
case pressit(1)+myselectpoint of
90:return90Click(nil);
91:return91Click(nil);
35:return35Click(nil);
else

p102_l7Click(nil);
end;

end;

lm_enter:begin

case pressit(1)+myselectpoint of
21:if myplaylist.itemindex>-1 then
myplaylistClick(nil);
35:begin

clssong;
if edit1.text='' then
exit;
select35($3D);
showok(90);
end;

end;

end;

lm_Pgup:begin
//U 上页
{
oldcolor:=p102_l7.font.Color;
p102_l7.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
p102_l7.font.Color :=oldcolor;
}
case pressit(1) of
21:p92_EClick(nil);
22:select22(1039);
24:p24_9Click(nil);
31..34:returnone;
35:p35_l8Click(nil);
90:select90(1030);
91:select91(1030);
92..93:returnone;
end;

end;


lm_Pgdn:begin
//D 下页
{
oldcolor:=p102_l8.font.Color;
p102_l8.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
p102_l8.font.Color :=oldcolor;
}
case pressit(1) of
21:p92_FClick(nil);
24:p24_0Click(nil);
35:p35_l9Click(nil);
90:select90(1039);
91:select91($3A);
end;

end;

lm_left:begin

case pressit(1)+myselectpoint of
90:begin

if not song_w_d.Enabled then
exit;
if arrow4.Visible then
mysql.song_numb:='';
arrow3.Visible:=true;
arrow4.Visible:=false;
arrow3.Left:=findit(arrow3.Left,true,tstr);
arrow3.hint:=tstr;
mysql.py_sx:=tstr;
if p0_l6.tag=1 then

begin

tint1:=pos('拼音缩写 like &quot;',mysql.tsql);
if tint1>0 then

begin

delete(mysql.tsql,tint1+15,1);
insert(mysql.py_sx,mysql.tsql,tint1+15 );
end
else

begin

tint1:=pos('where ',mysql.tsql);
insert('拼音缩写 like &quot;'+mysql.py_sx+'%&quot;
and ',mysql.tsql,tint1+6);
end;

end;

// mysql.song_numb:='';
showmypos_pic.hint:='-1';
timer4.Enabled:=false;
timer4.Enabled :=true;
// sqlsong(true);
end;

24:begin

arrow6.Left:=findit(arrow6.Left,true,tstr);
sqlfirstword(tstr);
showfirstword(1);
end;

91:begin

arrow2.Left:=findit(arrow2.Left,true,tstr);
arrow2.hint:=tstr;
mysql.player_name_sx:=tstr;
timer4.Enabled:=false;
timer4.Enabled :=true;
// sqlplayer;
end;

end;

end;

lm_right:begin

case pressit(1)+myselectpoint of
90:begin

if not song_w_d.Enabled then
exit;
if arrow4.Visible then
mysql.song_numb:='';
arrow3.Visible:=true;
arrow4.Visible:=false;
arrow3.Left:=findit(arrow3.Left,false,tstr);
arrow3.hint:=tstr;
mysql.py_sx:=tstr;
if p0_l6.tag=1 then

begin

tint1:=pos('拼音缩写 like &quot;',mysql.tsql);
if tint1>0 then

begin

delete(mysql.tsql,tint1+15,1);
insert(mysql.py_sx,mysql.tsql,tint1+15 );
end
else

begin

tint1:=pos('where ',mysql.tsql);
insert('拼音缩写 like &quot;'+mysql.py_sx+'%&quot;
and ',mysql.tsql,tint1+6);
end;

end;

// mysql.song_numb:='';
showmypos_pic.hint:='-1';
timer4.Enabled:=false;
timer4.Enabled :=true;
// sqlsong(true);
end;

24:begin

arrow6.Left:=findit(arrow6.Left,false,tstr);
sqlfirstword(tstr);
showfirstword(1);
end;

91:begin

arrow2.Left:=findit(arrow2.Left,false,tstr);
arrow2.hint:=tstr;
mysql.player_name_sx:=tstr;
timer4.Enabled:=false;
timer4.Enabled :=true;
// sqlplayer;
end;

end;

end;

lm_up:begin

case pressit(1)+myselectpoint of
35:select35(1038);
21:begin

if myplaylist.itemindex>0 then
myplaylist.itemindex:=myplaylist.itemindex-1;
end;

24:begin

select24($3B);
end;

90:begin

if not k09.Enabled then
exit;
arrow4.Visible:=true;
arrow3.Visible:=false;
arrow4.Top:=findit_word_nmb(arrow4.Top,true,tstr);
showmypos_pic.hint:=tstr;
timer4.Enabled:=false;
timer4.Enabled :=true;
// numbsqlsong(true)(tstr);
end;

end;

end;

lm_down:begin

case pressit(1)+myselectpoint of
35:select35(1039);
21:begin

if myplaylist.itemindex<myplaylist.count-1 then
myplaylist.itemindex:=myplaylist.itemindex+1;
end;

24:begin

select24($3A);
end;

90:begin

if not k09.Enabled then
exit;
arrow4.Visible:=true;
arrow3.Visible:=false;
arrow4.Top:=findit_word_nmb(arrow4.Top,false,tstr);
showmypos_pic.hint:=tstr;
timer4.Enabled:=false;
timer4.Enabled :=true;
// numbsqlsong(true)(tstr);
end;

end;

end;


lm_Play:begin

select102(1038);
//P 播放
end;


lm_Next:begin
//F 快进
select102(1036);
end;

lm_Last:begin
//L 快退
{
oldcolor:=p102_l4.font.Color;
p102_l4.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
p102_l4.font.Color :=oldcolor;
}
select102(1035);
end;


lm_Channel:begin
//H 声道
{
oldcolor:=p102_l10.font.Color;
p102_l10.font.Color :=newcolor;
while((GetTickCount-lTime) / 100 <lastime)do
application.processMessages ;
p102_l10.font.Color :=oldcolor;
}
currsoundpath:=not currsoundpath;
if currsoundpath then
select102(1033) else
select102(1034);
end;

lm_Clear:begin
//A 清空
playing_song.Clear;
myplaylist.items.Clear;
selectchang;
end;

lm_Service:begin
//S 呼叫总台
select93(1031);
showok(93);
end;

end;

end;


procedure Tnsktv.FormKeyDown(Sender: TObject;
var Key: Word;Shift: TShiftState);
var i:integer;
begin

i:=0;
if key=192 then

begin

if ifOpenDVDDriver then

if ghMPEGStream>0 then

begin

if_tv:=not if_tv;
outof(ghMPEGStream,if_tv);
//从哪里输出
// VGA---false
// tv---true
end;

end;

onKeyDown:=nil;
allselect(keymap(key));
if key=27 then
returnone;
if sender is Tform then
i:=pressit(key) else
exit;
case i+myselectpoint of //在哪个面板上 i 为面板代号 selectXX(key) 为在XX页要处理的事务
0:begin

clsmysql;
//将SQL记录删除
select0(keymap(key));
//主选择窗口
end;

11:begin

select11(keymap(key));
//按歌曲分类窗口 :新歌推荐,流行金曲 第一页
end;

{
12:begin

select12(keymap(key));
//按歌曲分类窗口 :新歌推荐,流行金曲 第二页
end;

}
21:begin

select21(keymap(key));
//按歌曲字数分类窗口 :一字,二字 第一页
end;

22:begin

select22(keymap(key));
//按歌曲字数分类窗口 :九字,十字 第二页
end;

24:begin

select24(keymap(key));
//按歌曲字数分类窗口 :九字,十字 第二页
end;


34:begin

select34(keymap(key));
//按外国语种分类
end;

35:begin

select35(keymap(key));
end;

36:begin

select36(keymap(key));
end;


90:begin

select90(keymap(key));
//歌曲列表,在此窗口选择歌星,歌星存放在playerlist列表内,每一页有6个歌曲
end;

91:begin

select91(keymap(key));
//歌星列表,在此窗口选择歌星,歌星存放在playerlist列表内,每一页有6个歌手
end;

92:begin

select102(keymap(key));
//音量设置
end;

93:begin

select93(keymap(key));
//音量设置
end;

end;

application.ProcessMessages;
onKeyDown:=FormKeyDown;
end;


function Tnsktv.pressit(key:word):integer;
var
I: Integer;
tstr:string;
begin

result:=0;
for I := 0 to nsktv.ComponentCount - 1do

if nsktv.Components is Tpanel then

if (uppercase(nsktv.Components.Name[1])='P')and(nsktv.Components as Tpanel).Visible=true then

begin

tstr:=(nsktv.Components as Tpanel).Name;
result:=strtoint(copy((nsktv.Components as Tpanel).Name,2,length((nsktv.Components as Tpanel).Name)-1));
exit;
end;

end;




function Tnsktv.keymap(Key: Word):word;
begin

result:=0;
if key= kb_exit then
result:=lm_exit;
// /退出
if key= kb_Return then
result:=lm_Return;
//ESC 返回
if key= kb_NextSong then
result:=lm_NextSong;
//N 下一曲
if key= kb_Channel_1 then
result:=lm_Channel_1;
//N 原唱
if key= kb_Channel_2 then
result:=lm_Channel_2;
//N 伴唱
if key= kb_Channel then
result:=lm_Channel;
//H 声道
if key= kb_replay then
result:=lm_replay;
//N 重唱
if key= kb_menu then
result:=lm_menu;
//N 目录
if key= kb_enter then
result:=lm_enter;
//N 确认

if key= kb_left then
result:=lm_left;
//N 向左
if key= kb_right then
result:=lm_right;
//N 向右
if key= kb_down then
result:=lm_down;
//N 确认
if key= kb_up then
result:=lm_up;
//N 确认


if key= kb_Pause then
result:=lm_Pause;
//C 暂停
if key= kb_Priority then
result:=lm_Priority;
//R 优先
if key= kb_Pgup then
result:=lm_Pgup;
//U 上页
if key= kb_Pgdown then
result:=lm_Pgdn;
//D 下页
if key= kb_Next then
result:=lm_Next;
//F 快进
if key= kb_Last then
result:=lm_Last;
//L 快退


if key= kb_Clear then
result:=lm_Clear;
//A 清空
if key= kb_Del then
result:=lm_Del;
//E 删除
if key= kb_Service then
result:=lm_Service;
//S 呼叫总台
if key= kb_Volup then
result:=lm_Volup;
//V 加大音量
if key= kb_Voldown then
result:=lm_Voldown;
//O 减少音量
if key= kb_Num0 then
result:=lm_Num0;
//数字0 选择 0
if key= kb_Num1 then
result:=lm_Num1;
//1 选择 1
if key= kb_Num2 then
result:=lm_Num2;
//2 选择 2
if key= kb_Num3 then
result:=lm_Num3;
//3 选择 3
if key= kb_Num4 then
result:=lm_Num4;
//4 选择 4
if key= kb_Num5 then
result:=lm_Num5;
//5 选择 5
if key= kb_Num6 then
result:=lm_Num6;
//6 选择 6
if key= kb_Num7 then
result:=lm_Num7;
//7 选择 7
if key= kb_Num8 then
result:=lm_Num8;
//8 选择 8
if key= kb_Num9 then
result:=lm_Num9;
//9 选择 9
// if key= 37 then
result:=37;
//<-
// if key= 39 then
result:=39;
//->
if result=0 then
result:=key;

end;



procedure Tnsktv.showmag(mag:string;kind:boolean);
begin

if findwindow('tmagfrm',nil)<>0 then

begin

with magfrmdo

begin

Timer1.Enabled :=false;
if kind then
timer1.Interval:=5000 else
timer1.Interval:=showmessagetimeout;
maglabel.Caption :=mag;
Timer1.Enabled :=true;
end;

end
else

try
if (not kind)and(showmessagetimeout=0) then
exit;
magfrm:=Tmagfrm.Create(application);
magfrm.Timer1.Enabled :=false;
if kind then
timer1.Interval:=5000 else
timer1.Interval:=showmessagetimeout;
magfrm.Timer1.Enabled :=true;
magfrm.maglabel.Caption :=mag;
magfrm.ShowModal;
magfrm.Free;
except
end;

end;


procedure Tnsktv.closeme;
var
t:integer;
begin

closestream( ghMPEGStream );
ghMPEGStream := 0;
SystemParametersInfo(SPI_SETFASTTASKSWITCH, 0, @t, 0);
//恢复系统热键
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, @t, 0);
//恢复系统热键
showTaskbar;
//显示任务条
self.close;
end;




procedure Tnsktv.inistate(mykind:string;path:string);
var
tint:integer;
filename:string;
begin

for tint:= 0 to nsktv.ComponentCount - 1do

if copy(nsktv.Components[tint].Name,1,3)=mykind then

begin

case mykind[3] of
'1':begin

timage(nsktv.Components[tint]).AutoSize:=true;
timage(nsktv.Components[tint]).left:=_1_2.Left ;
timage(nsktv.Components[tint]).top:=_1_2.top ;
timage(nsktv.Components[tint]).Height:=_1_2.Height ;
timage(nsktv.Components[tint]).Width:=_1_2.Width ;
end;

'2':begin

timage(nsktv.Components[tint]).AutoSize:=true;
timage(nsktv.Components[tint]).left:=_2_2.Left ;
timage(nsktv.Components[tint]).top:=_2_2.top ;
timage(nsktv.Components[tint]).Height:=_2_2.Height ;
timage(nsktv.Components[tint]).Width:=_2_2.Width ;
end;

'3':begin

timage(nsktv.Components[tint]).AutoSize:=true;
timage(nsktv.Components[tint]).left:=_3_2.Left ;
timage(nsktv.Components[tint]).top:=_3_2.top ;
timage(nsktv.Components[tint]).Height:=_3_2.Height ;
timage(nsktv.Components[tint]).Width:=_3_2.Width ;
end;

end;

filename:=ExtractFilePath(paramstr(0))+'/PICT/skin/'+path;
if fileexists(filename+'.bmp') then

timage(nsktv.Components[tint]).Picture.LoadFromFile(filename+'.bmp')
else

if fileexists(filename+'.jpg') then

timage(nsktv.Components[tint]).Picture.LoadFromFile(filename+'.jpg');
end;

end;






procedure Tnsktv.showstate(mykind:string;showit1:boolean);
var
tint:integer;
begin

try
if (mykind='---') then

begin

for tint:= 0 to nsktv.ComponentCount - 1do

if(nsktv.Components[tint] is timage)and(nsktv.Components[tint].Name[1]='_') then

timage(nsktv.Components[tint]).Visible :=false;
exit;
end;

for tint:= 0 to nsktv.ComponentCount - 1do

begin

if trim(nsktv.Components[tint].Name)<>'' then

if(nsktv.Components[tint].Name[1]='_')and(nsktv.Components[tint].Name[3]='_') then

case mykind[2] of
'1':begin

if (nsktv.Components[tint].Name[1]='_') and (nsktv.Components[tint].Name[2]<>'3') then

timage(nsktv.Components[tint]).Visible :=false;
end;

'2':begin


if (nsktv.Components[tint].Name[1]='_') and (nsktv.Components[tint].Name[2]<>'3') then

timage(nsktv.Components[tint]).Visible :=false;
end;

'3':begin

// timage(nsktv.Components[tint]).Visible :=false;
end;

end;

end;

except
end;

if (mykind='---') then
exit;
for tint:= 0 to nsktv.ComponentCount - 1do

begin

if copy(nsktv.Components[tint].Name,1,3)=mykind then

case nsktv.Components[tint].Name[2] of
'1':timage(nsktv.Components[tint]).Visible :=showit1;
'2':timage(nsktv.Components[tint]).Visible :=showit1;
'3':timage(nsktv.Components[tint]).Visible :=showit1;
end;

end;

end;




procedure Tnsktv.iniquery;
begin

mysql.tsql:='select * from 歌曲 where id in (select top 600 id from 歌曲 order by 排行 desc)order by 排行';
sqlsong(false);
// showsong(5);
end;



procedure Tnsktv.FormCreate(Sender: TObject);
var
inime: Tinime;
computername_size:dword;
pComputerName,Tmyname,Tiflockme,Tsendtime:pchar;
ttstr:string;

ttt:integer;
tt:pchar;
tt1,tt2,tt3:string;
myselecten1,myselecten2:integer;
ttint1,ttint2,ttint3,ttint4:integer;
part1,part2,part3,part4:string;
S1, S2, S3: string;
mypad:tpanel;
begin

p00.Visible :=true;
p11.Visible :=false;
p21.Visible :=false;
p22.Visible :=false;
p24.Visible :=false;
p34.Visible :=false;
p35.Visible :=false;
p36.Visible :=false;
p90.Visible :=false;
p91.Visible :=false;
p93.Visible :=false;
myexitpassword:='';
myexitmode:=0;
love1:=53255;
love2:=653763;
love3:=54235;
love4:=7689459;
Getmylove(s1,s2,s3);
love1:=1328930;
love2:=930335;
love3:=543661;
love4:=543623;
randomize;
ttt:=0;
inimousemove;
iniplaystate;
with nsktvdo

begin

Height:=480;// screen.Height;
Width:=640;// screen.Width;
left:=0;
top:=0;
end;

tmyvol:=0.5;
myip:=LocalIP1(true);
showstate('---',false);
inistate('_1_','原唱1');
inistate('_2_','伴唱1');
inistate('_3_','播放1');
mydb:= loadlibrary(pchar(ExtractFilePath(paramstr(0))+'/NSKTVYKD.dll'));
if mydb <> null then

begin

@inime := GetProcAddress(mydb, 'inime');
if (@inime = Nil) then

begin

halt;
end;

end;

FreeLibrary(mydb);
try
myselectpoint:=ord('a')-ord('a');
tt2:=formatdatetime('yyyymmddhhMM',now);
tt:=inime(pchar(tt2),pchar(paramstr(0)));
tt2:=LogEntry(MD5String(formatdatetime('hm',now)+formatdatetime('yyyymmddhhMM',now)));
tt1:=tt;
for ttt:=1 to 32do

begin

myselectpoint:=myselectpoint+(ord(copy(LogEntry(MD5String(formatdatetime('hm',now)+formatdatetime('yyyymmddhhMM',now))),ttt,1)[1])-ord(copy(tt1,ttt,1)[1]));
end;


if getmacid(0)='notinstall' then

begin

self.OnActivate:=nil;
self.OnKeyDown:=nil;
self.OnMouseDown:=nil;
self.OnMouseMove:=nil;
self.OnCloseQuery:=nil;
timer1.OnTimer:=nil;
timer2.OnTimer:=nil;
timer3.OnTimer:=nil;
timer4.OnTimer:=nil;
timer5.OnTimer:=nil;
timer6.OnTimer:=nil;
WritePrivateProfileString('err','errmsg','您还没有安装网卡或驱动没有正常安装',pchar(ExtractFilePath(paramstr(0))+'/error.txt'));
messagebox(0,'您还没有安装网卡或驱动没有正常安装','程序错误',mb_ok+mb_iconerror);
exit;
end;

Tfirstword:=tstringlist.Create;
mysongpath:=false;
getmem(tt,255);
getmem(tmyname,255);
getmem(Tsendtime,255);
getmem(tiflockme,255);
GetWindowsDirectory(tmyname,255);
//gettime(tmyname,mymaxdate);
GetPrivateProfileString('自定义广告板', 'myname', '明日VOD',tmyname,225,pchar(ExtractFilePath(paramstr(0))+'/nsvod.ini'));
GetPrivateProfileString('system', 'iflockme', '0',tiflockme,225,pchar(ExtractFilePath(paramstr(0))+'/nsvod.ini'));
GetPrivateProfileString('system', 'sendtime', '120',Tsendtime,225,pchar(ExtractFilePath(paramstr(0))+'/nsvod.ini'));
ttstr:=getid1(getmacid(0));
myselecten1:=ord(copy(DenCrypt(ttstr,'ah2a4lq'+chr(70+random(30))+formatdatetime('s',now)),length(DenCrypt(ttstr,chr(70+random(30))+formatdatetime('s',now)+'ah2a4lq'))-3,1)[1]) mod 9;
myselecten2:=ord(copy(DenCrypt(ttstr,chr(70+random(30))+formatdatetime('s',now)+'ah2a4lq'),length(DenCrypt(ttstr,'ah2a4lq'+chr(70+random(30))+formatdatetime('s',now)))-3,1)[1]) mod 9;


WritePrivateProfileString('system','myoldcode',pchar(DenCrypt(ttstr,'a#ga4:=')),pchar(ExtractFilePath(paramstr(0))+'/nsvod.ini'));
//WritePrivateProfileString('system','myoldcode',pchar(DenCrypt(getid1(getmacid(0)),'a#ga4:=')),pchar(ExtractFilePath(paramstr(0))+'/nsvod.ini'));
GetPrivateProfileString('system', 'mycode', '',tt,225,pchar(ExtractFilePath(paramstr(0))+'/nsvod.ini'));
tt3:=tt;

{
注册部分

}

if tiflockme='1' then
iflockme:=true else
iflockme:=false;
showmessagetimeout:=0;
myname:=Tmyname;
addmemo('进入系统');
nsktv.Hide;
ifdisplaydemo:=false;
if_del_pre:=0;
allowplay:=true;
begin
f:=0;
endf:=0;
if_tv:=true;
commandlist:=tstringlist.Create;
playing_song:=tstringlist.Create;
playerlist:=tstringlist.Create;
commandlist.Clear ;
playing_song.Clear;
playerlist.Clear ;
timer2.Enabled :=true;
nsktv.onkeydown:=nil;
ComputerName_size:=255;
getmem(pComputerName,ComputerName_size);
getComputerName(pComputerName,ComputerName_size);
ComputerName:=pComputerName;
allip:=string(LocalIP(true));
//得到本地IP
if paramstr(1)='aboutme' then

begin

aboutme_f:=Taboutme_f.Create(application);
aboutme_f.Show;
end;

lastime:=2;
ifOpenDVDDriver:=false;
if not opendrv then
showmag('打开DVD驱动出错,请确认是否安装解压卡',true)
else

ifOpenDVDDriver:=true;
showok(0);
application.ProcessMessages;
changskin(0);
//更换皮肤
tiniapp.Create;
//做为测试而加
inidb;
ininowplay;
inibackgrouplaylist;
SetTimer(nsktv.Handle,1,4000,@timepro.replaylistProc);
//读歌曲列表
ttt:=abs(strtointdef(Tsendtime,60))*1000;
SetTimer(nsktv.Handle,2,ttt,@timepro.requestdbProc);
//请求联接
SetTimer(nsktv.Handle,8,4300,@timepro.pingProc);
//PING 服务器
SetTimer(nsktv.Handle,10,74,@enablekeydown);
//恢复键盘响应
sendmag('R'+myip+'@'+myname,allip);
sendmag('M'+myip+'@'+myname,allip);
nsktv.Show;
nsktv.Update;
iniquery;
self.OnActivate:=nil;
self.OnKeyDown:=nil;
self.OnMouseMove:=nil;
end;



function Tnsktv.playbackgrouplaylist(myplaylist:tstringlist):string;
//找到要播放的背景音乐路径
var
tint,tint2:integer;
tplaystr,tstr:string;
begin

tint:=myplaylist.count;
for tint:=0 to tint-1do

begin

tint2:=pos('1-',myplaylist.strings[tint]);
if tint2>0 then
//找到要播放的项目
begin

tplaystr:=copy(myplaylist.strings[tint],3,100);
tstr:=myplaylist.Strings[tint];
system.Delete(tstr,1,1);
myplaylist.Strings[tint]:='0'+tstr;
if tint=myplaylist.count-1 then

begin

tstr:=myplaylist.Strings[0];
system.Delete(tstr,1,1);
myplaylist.Strings[0]:='1'+tstr;
end
else

begin

tstr:=myplaylist.Strings[tint+1];
delete(tstr,1,1);
myplaylist.Strings[tint+1]:='1'+tstr;
end;

break;
end;

end;

if trim(tplaystr)='' then
tplaystr:=ExtractFilePath(paramstr(0))+'背景广告';

result:=tplaystr;
end;


procedure Tnsktv.inibackgrouplaylist;
var
d:integer;
tstr:string;
begin

backgrouplaylist:=tstringlist.create;
dm.songqur.close;
dm.songqur.SQL.Clear;
dm.songqur.SQL.Add('select top 30 路径 from 歌曲 order by 排行 desc');
dm.songqur.Open;
d:=0;
while ((d>=10)and(not dm.songqur.Eof))or(d<30)do

begin

if fileexists(dm.songqur.fieldbyname('路径').AsString) then

begin

backgrouplaylist.Add('0-'+dm.songqur.fieldbyname('路径').AsString);
end;

dm.songqur.Next;
inc(d);
end;

dm.songqur.close;
dm.songqur.sql.Clear;
if backgrouplaylist.Count >0 then

begin

tstr:=backgrouplaylist.Strings[0];
delete(tstr,1,1);
backgrouplaylist.Strings[0]:='1'+tstr;
end;

end;


function Min(a, b: integer): integer;
begin

if (a < b) then

Result := a
else

Result := b;
end;






procedure Tnsktv.changskin(kind:integer);
begin

case kind+myselectpoint of
0:begin

end;

1:begin

end;

end;

if my_resize<>nil then
my_resize.Create;
application.ProcessMessages;
if my_resize2<>nil then
my_resize2.Create;
end;


procedure Tnsktv.clsmysonglist;
//将歌曲列表中所有歌曲清除
var
tpoint:psonglist;
begin

try
new(tpoint);
while not(songlist=nil)do

begin

tpoint:=songlist;
songlist:=songlist^.nextp;
dispose(tpoint);
end;

except
end;


end;




function Tnsktv.ifexit:boolean;
var
tpw,tdbpw:string;
begin

dowm_f:=tdowm_f.Create(application);
dowm_f.ShowModal ;
dowm_f.free;
ifshowdown:=false;
tpw:=myexitpassword;
result:=false;
if not dm.song_conn.Connected then

begin

result:=true;
exit;
end;

with dm.songqurdo

begin

close;
sql.clear;
sql.Add('select * from 密码');
open;
tdbpw:=fieldbyname('密码').AsString;
// if tdbpw='' then
tdbpw:='123';
if tpw=tdbpw then
result:=true;
close;
application.ProcessMessages;
end;

end;



procedure Tnsktv.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
var
tstr1:string;
winpath:pchar;
begin

if ifexit then
canclose:=true
else

begin

canclose:=false;
exit;
end;

canclose:=true;
//改变分辩率
if OldResolution<>screen.Width then

try
case OldResolution+myselectpoint of //还原分辨率
640:SetScreenResolution(640,480,OldFreqency);
800:SetScreenResolution(800,600,OldFreqency);
1024:SetScreenResolution(1024,768,OldFreqency);
1152:SetScreenResolution(1152,864,OldFreqency);
1280:SetScreenResolution(1280,1024,OldFreqency);
else

SetScreenResolution(800,600,OldFreqency);
end;

except
end;

addmemo('退出系统');
// saveplaylist;
deletefile(ExtractFilePath(paramstr(0))+'playlist.lst');
tag:=300;
//发出关机信号
sendmag('D'+myname,allip);
// gg.Close ;
self.onCloseQuery:=nil;
ghMPEGStream := 0;
if myexitmode=2 then

do
wnme
else

closeme;
end;


procedure Tnsktv.p0_l3Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select0(1037);
enableok(oldpan,true);
end;


procedure Tnsktv.p0_l4Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
p0_l6.tag:=1;
nowplay_0.Tag:=1;
select0(1033);
enableok(oldpan,true);
end;



procedure Tnsktv.inidb();
var
strConn:string;
t:integer;
ifok:boolean;
Tstr1:string;
Winpath:pchar;
db:pchar;
myinifilepath:pchar;
begin

dm.song_conn.ConnectionTimeout :=1;
dm.song_conn.CommandTimeout:=1;
ifok:=true;
getmem(db,225);
myinifilepath:=pchar(ExtractFilePath(paramstr(0))+'nsvod.ini');
GetPrivateProfileString('loc_song', 'db', 'song',db,225,myinifilepath);
strconn:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+db+';Persist Security Info=true;Jet OLEDB:Database Password=luoming';
try
with dm.song_conn do

begin

Connected:=false;
ConnectionString:=strConn;
Connected:=true;
end;

except
ifok:=false;
end;

if not ifok then

begin

self.OnKeyDown:=nil;
self.OnMouseMove:=nil;
self.OnCloseQuery:=nil;
backgrou.OnTimer:=nil;
timer1.OnTimer:=nil;
timer2.OnTimer:=nil;
timer3.OnTimer:=nil;
timer4.OnTimer:=nil;
timer5.OnTimer:=nil;
timer6.OnTimer:=nil;


SystemParametersInfo(SPI_SETFASTTASKSWITCH, 0, @t, 0);
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, @t, 0);
showTaskbar;
//恢复
addmemo('初始化时出错!,请卸载本系统后重新安装 ');
ShowMag('初始化时出错!,请卸载本系统后重新安装 ',true);
exit;
end;

end;


function HToD(Hexa:string):longint;
const
ValoresHexa : array['A'..'F'] of integer = (10,11,12,13,14,15);
var
nDecimal : longint;
nIndex : byte;
begin

nDecimal := 0;
Hexa := Uppercase(Hexa);
for nIndex := Length(Hexa)do
wnto 1do

if Hexa[nIndex] in ['0'..'9']
then
nDecimal := nDecimal + StrToInt(Hexa[nIndex]) *
Trunc(Exp((Length(Hexa)-nIndex)*ln(16)))
else
nDecimal := nDecimal + ValoresHexa[Hexa[nIndex]] *
Trunc(Exp((Length(Hexa)-nIndex)*ln(16)));
result:= nDecimal;
end;



procedure Tnsktv.Checkok;
Var
NCB : TNCB;
// Netbios control block //NetBios控制块
ADAPTER : TADAPTERSTATUS;
// Netbios adapter status//取网卡状态
LANAENUM : TLANAENUM;
// Netbios lana
intIdx : Integer;
// Temporary work value//临时变量
cRC : Char;
// Netbios return code//NetBios返回值
strTemp : String;
// Temporary string//临时变量
begin

Try
// Zero control blocl
ZeroMemory(@NCB, SizeOf(NCB));

// Issue enum command
NCB.ncb_command := Chr(NCBENUM);
cRC := NetBios(@NCB);

// Reissue enum command
NCB.ncb_buffer := @LANAENUM;
NCB.ncb_length := SizeOf(LANAENUM);
cRC := NetBios(@NCB);
If Ord(cRC)<>0 then

exit;

// Reset adapter
ZeroMemory(@NCB, SizeOf(NCB));
NCB.ncb_command := Chr(NCBRESET);
NCB.ncb_lana_num := LANAENUM.lana[0];
cRC := NetBios(@NCB);
If Ord(cRC)<>0 then

exit;

// Get adapter address
ZeroMemory(@NCB, SizeOf(NCB));
NCB.ncb_command := Chr(NCBASTAT);
NCB.ncb_lana_num := LANAENUM.lana[0];
StrPCopy(NCB.ncb_callname, '*');
NCB.ncb_buffer := @ADAPTER;
NCB.ncb_length := SizeOf(ADAPTER);
cRC := NetBios(@NCB);
// Convert it to string
strTemp := '';
For intIdx := 0 To 5do

strTemp := strTemp + Inttostr(Integer(ADAPTER.adapter_address[intIdx])+1);
p00.Hint:=strTemp;
Finally
end;

end;




function Tnsktv.DenCrypt(Str : string;
Key : string): string;
var
X, Y : Integer;
A : Byte;
begin

if Key = '' then
Key := 'd1duOsy3n6qrPr2eF9u';
Y := 1;
for X := 1 to length(Str)do
begin

A := (ord(Str[X]) and $0f) xor (ord(Key[Y]) and $0f);
Str[X] := char((ord(Str[X]) and $f0) + A);
inc(Y);
if Y > length(Key) then

Y := 1;
end;

Result := Str;
end;



procedure Tnsktv.udpcDataReceived(Sender: TComponent;
NumberBytes: Integer;
FromIP: String;
Port: Integer);
var
TStream1: TMemoryStream;
tstr,mysay,tpath:string;
myselect:char;
tmypath:pchar;
lTime :TDateTime;
OS: TOSVersionInfo;
begin

if tag=300 then
exit;
// allip:=fromip;
FlatHint1.Tag :=p0_l3.Tag;
if allip='127.0.0.255' then

begin

// showmag('请确认安装好网卡,或是否指定本机IP地址,'+#13+
// '请指定IP地址,如指定IP为&quot;192.168.0.100&quot;'+#13+
// '请安装好网卡并指定IP地址后再启动系统');
exit;
end;

TStream1:=TMemoryStream.Create;
try
UDPc.ReadStream(TStream1);
SetLength(tstr, NumberBytes);
TStream1.Read(tstr[1],NumberBytes);
TStream1.Free;
except
exit;
end;

tstr:=DenCrypt(tstr,'');
myselect:=tstr[1];
if myselect='_' then
exit;
tstr:=copy(tstr,2,length(tstr)-1);
myselect:=tstr[1];
mysay:=rightstr(tstr,length(tstr)-1);
case chr(ord(myselect)+myselectpoint) of
'F':begin
//'&'+32=F
myselectpoint:=0;
end;

'M':begin
//收到微服务器反馈
if mysay>inttostr(mymaxdate) then

begin

getmem(tmypath,255);
GetWindowsDirectory(tmypath,255);
// settime(tmypath,strtoint(mysay));
mymaxdate:=strtoint(mysay);
freemem(tmypath);
end;

end;

'W':begin

sendmag('M',allip)
end;

'R':begin
//联机成功,可以点播
if dm.song_conn.Connected then
exit;
inidb;
allowplay:=true;
mysay:=copy(tstr,pos('^~',tstr)+2,length(tstr)-pos('^~',tstr)+2);
showmag(mysay,false);
end;

'O':begin
//总台向包箱发送消息,如果收到消息则反馈回服务器“我收到”
mysay:=copy(tstr,pos('^~',tstr)+2,length(tstr)-pos('^~',tstr)+2);
tstr:=copy(tstr,2,pos('^~',tstr)-2);
if tstr<>'ALL' then

if tstr=myname then

begin

tstr:='G'+myname+'收到消息';
if pos('联接服务器',mysay)=0 then
sendmag(tstr,allip);
//反馈给服务器我以收到消息
showmag(mysay,false);
//显示消息
end;

end;

'Q':begin
//总台向包箱发送消息,如果收到消息则反馈回服务器“我收到”
mysay:=copy(tstr,pos('^~',tstr)+2,length(tstr)-pos('^~',tstr)+2);
showmag(mysay,false);
P93_box1.Clear ;
while length(mysay)<>0do

begin

P93_box1.Items.Add(copy(mysay,1,pos(#13,mysay)-1));
delete(mysay,1,pos(#13,mysay));
end;

end;

'K':begin
//总台下达锁定指令
if mysay='ok' then

iflockme:=true
else

iflockme:=false;
end;

'H':begin
//总台下达火警
playing_song.Clear;
myplaylist.clear;
closestream(ghMPEGStream);
ghMPEGStream:=0;
ifdisplaydemo:=true;
ghMPEGStream :=play(ExtractFilePath(paramstr(0))+'火警');
end;

'D':begin
//总台下达关机指令
if mysay<>myname then
exit;
showmag('服务总指令---关机操作',false);
nsktv.OnCloseQuery:=nil;
if ghMPEGStream<>0 then

begin

closestream( ghMPEGStream );
ghMPEGStream := 0;
end;

deletefile(ExtractFilePath(paramstr(0))+'playlist.lst');
do
wnme;
ExitWindowsEx(EWX_SHUTDOWN, 0);
end;

'T':begin

if mysay<>'ok' then

myselectpoint:=myselectpoint-1;
end;

end;

end;


function Tnsktv.DebuggerPresent: boolean;
type
TDebugProc = function: boolean;
stdcall;

var
Kernel32: HMODULE;

DebugProc: TDebugProc;

begin

Result := False;

Kernel32 := GetModuleHandle('kernel32.dll');

if Kernel32 <> 0 then

begin

@DebugProc := GetProcAddress(Kernel32, 'IsDebuggerPresent');

if Assigned(DebugProc) then

Result := DebugProc;

end;


end;





function Tnsktv.UpTime: string;
const
ticksperday: integer = 1000 * 60 * 60 * 24;

ticksperhour: integer = 1000 * 60 * 60;

ticksperminute: integer = 1000 * 60;

tickspersecond: integer = 1000;

var
t: longword;
d, h, m, s: integer;
begin

t := GetTickCount;
d := t div ticksperday;
dec(t, d * ticksperday);
h := t div ticksperhour;
dec(t, h * ticksperhour);
m := t div ticksperminute;
dec(t, m * ticksperminute);
s := t div tickspersecond;
Result := 'Uptime: ' + IntToStr(d) + ' Days ' + IntToStr(h) + ' Hours ' + IntToStr(m) + ' Minutes ' + IntToStr(s) + ' Seconds';
end;


procedure Tnsktv.p0_l5Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
//select0(1035);
enableok(oldpan,true);
end;


procedure Tnsktv.p35_l0Click(Sender: TObject);
var
myselect:string;
mykey:integer;
begin

myselect:=copy((sender as timage).Name,length((sender as timage).Name),1);
if myselect='A' then
myselect:='8';
if myselect='B' then
myselect:='9';
case py_pagenumb+myselectpoint of
1:mykey:=65;
2:mykey:=73;
3:mykey:=81;
end;

mykey:=mykey+strtoint(myselect);
edit1.text:=edit1.text+chr(mykey);
my_enter_py.Caption:=edit1.text;
end;


procedure Tnsktv.p0_l8Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
if_del_pre:=0;
loadpict(p21_i1,'mysel');
showok(21);
enableok(oldpan,true);
end;


procedure Tnsktv.p91_l1Click(Sender: TObject);
begin

select91(1031);
end;


procedure Tnsktv.p91_l2Click(Sender: TObject);
begin

select91(1032);
end;


procedure Tnsktv.p91_l3Click(Sender: TObject);
begin

select91(1033);
end;

procedure Tnsktv.p91_l4Click(Sender: TObject);
begin

select91(1034);
end;


procedure Tnsktv.p91_l5Click(Sender: TObject);
begin

select91(1035);
end;


procedure Tnsktv.p91_l6Click(Sender: TObject);
begin

select91(1036);
end;


procedure Tnsktv.p91_l7Click(Sender: TObject);
begin

select91(1037);
end;


procedure Tnsktv.p91_l8Click(Sender: TObject);
begin

select91(1038);
end;


procedure Tnsktv.p91_l9Click(Sender: TObject);
begin

select91(1039);
end;


procedure Tnsktv.p91_l0Click(Sender: TObject);
begin

select91(1030);
end;


procedure Tnsktv.p92_l4Click(Sender: TObject);
begin

select102(1034);
end;


procedure Tnsktv.p92_l0Click(Sender: TObject);
begin

select102(1030);
end;


procedure Tnsktv.selectchang;
var
tstr1,tstr2:string;
begin

if playing_song.count>0 then

begin

tstr1:=copy(currsong,pos(' 歌名:', currsong)+6,100);
tstr2:=copy(playing_song[0],pos(' 歌名:', playing_song[0])+6,100);
showplaystate(tstr1,tstr2);
end
else

begin

if getstate(ghMPEGStream)=1 then

begin

showplaystate('未选歌曲','未选歌曲');
end
else

begin

tstr1:=copy(currsong,pos(' 歌名:', currsong)+6,100);
showplaystate(tstr1,'请选择歌曲');
end;

end;

end;


procedure Tnsktv.readplaylist;
var
playlistfile:textfile;
playcount:string;
playfile_name:string;
t,tint1:integer;
begin

playcount:=ExtractFilePath(paramstr(0))+'playlist.lst';
if not fileexists(playcount) then
exit;
assignfile(playlistfile,playcount);
reset(playlistfile);
Readln(playlistfile, playcount);
//读出总共有多少个行,即多少文件
if playcount='' then
exit;
for t:=1 to strtoint(playcount)do

begin

try
readln(playlistfile,playfile_name);
//读出歌曲路径
playing_song.Add(playfile_name);
readln(playlistfile,playfile_name);
//读出歌曲名
myplaylist.Items.Add(playfile_name);
except
myplaylist.items.Clear ;
playing_song.Clear ;
closefile(playlistfile);
exit;
end;


end;

closefile(playlistfile);
selectchang;
end;



procedure Tnsktv.saveplaylist;
var
playlistfile:textfile;
playlistfilepath:string;
t:integer;
begin

playlistfilepath:=ExtractFilePath(paramstr(0))+'playlist.lst';
if (playing_song.Count=0)or(myplaylist.items.Count=0) then

begin

deletefile(playlistfilepath);
//删除列表文件
exit;
end;

try
assignfile(playlistfile,playlistfilepath);
rewrite(playlistfile);
writeln(playlistfile,inttostr(myplaylist.items.Count));
for t:=0 to myplaylist.items.Count-1do

begin

writeln(playlistfile,playing_song[t]);
writeln(playlistfile,myplaylist.Items.Strings[t]);
end;

finally
closefile(playlistfile);
end;

end;


procedure Tnsktv.Timer2Timer(Sender: TObject);
Function NBGetAdapterAddress(a:Integer) : String;
Var
NCB : TNCB;
// Netbios control block //NetBios控制块
ADAPTER : TADAPTERSTATUS;
// Netbios adapter status//取网卡状态
LANAENUM : TLANAENUM;
// Netbios lana
intIdx : Integer;
// Temporary work value//临时变量
cRC : Char;
// Netbios return code//NetBios返回值
strTemp : String;
// Temporary string//临时变量
begin

Result := '';
Try
ZeroMemory(@NCB, SizeOf(NCB));
NCB.ncb_command := Chr(NCBENUM);
cRC := NetBios(@NCB);
NCB.ncb_buffer := @LANAENUM;
NCB.ncb_length := SizeOf(LANAENUM);
cRC := NetBios(@NCB);
If Ord(cRC)<>0 then
exit;
ZeroMemory(@NCB, SizeOf(NCB));
NCB.ncb_command := Chr(NCBRESET);
NCB.ncb_lana_num := LANAENUM.lana[a];
cRC := NetBios(@NCB);
If Ord(cRC)<>0 then
exit;
ZeroMemory(@NCB, SizeOf(NCB));
NCB.ncb_command := Chr(NCBASTAT);
NCB.ncb_lana_num := LANAENUM.lana[a];
StrPCopy(NCB.ncb_callname, '*');
NCB.ncb_buffer := @ADAPTER;
NCB.ncb_length := SizeOf(ADAPTER);
cRC := NetBios(@NCB);
strTemp := '';
For intIdx := 0 To 5do

strTemp := strTemp + InttoHex(Integer(ADAPTER.adapter_address[intIdx]),2);
Result := strTemp;
Finally
end;

end;

function getpath(oldname:string):string;
var
tstr1,tstr2:string;
begin

tstr2:=oldname;
if pos('//',tstr2)=1 then

begin

tstr1:=copy(tstr2,3,length(tstr2)-2);
// lm/d/vod1/dd.dat
tstr1:='//'+copy(tstr1,pos('/',tstr1)+1,200);
// d/vod/dd.dat
tstr2:='//'+nsktv.songservernow+'/'+tstr1;
end
else
//d:/vod/dd.dat
begin

system.delete(tstr2,2,1);
tstr2:='//'+nsktv.songservernow+'/'+tstr2;
end;

result:=tstr2;
end;


var
tsql,tstr1,tstr2,tstr:string;
tsong_name,tplayer_name:string;
tsongid,tsongpath:string;
tsongsoundpath,vol_l,vol_r,brightness,contrast,saturation:integer;
tint0,tint1,tint2,tint3,tint4,tint5,tint6,tint7,tint8,tint9:integer;
iflocatesong:boolean;
myerr:dword;
mystate:integer;
//当前播放状态
ttstr:string;
//-----------------------------新迷惑-----------------------------------------//
crystr:string;
//-----------------------------加密代码---------------------------------------//
ttt:integer;
tt:pchar;
tt1,tt2,tt3:string;
myselecten1,myselecten2:integer;
ttint1,ttint2,ttint3,ttint4:integer;
part1,part2,part3,part4:string;
codeselecten1,codeselecten2,codeselecten3,codeselecten4:integer;
//注册码中,加密方法索引值
S1, S2, S3: string;
mypad:tpanel;
begin


if not(playing_song.count>0) then

begin

playing_song.clear;
myplaylist.clear;
showplaystate('请选择歌曲','未选歌曲 ');
exit;
end;

iflocatesong:=false;
//不是本地歌
mystate:=GetState(ghMPEGStream);


{
PAUSED 0;
STOPPED 1;
PLAYING 2;
SEEKING 3;
STEPPING 4;
CLOSED 5;
READY 6;
}

if (mystate=2)and(ifdisplaydemo=false) then
exit;
//如果正在播放退出
try
//10111010 歌手名:谭咏麟 歌名:讲不出再见
randomize;
case (strtoint(formatdatetime('s',now))mod 3) of
1:begin
//迷惑分支1
//10111010 歌手名:谭咏麟 歌名:讲不出再见
vol_l:=50;
//初始音量
vol_r:=50;
//初始音量
if love1=love2 then
love2:=930335 else
love2:=20;
if love1=love4 then
love2:=930335 else
love4:=50;
if love4=0 then
love1:=335 else
love1:=71;
if love2=love4 then
love4:=335 else
love2:=34;
love1:=1328930-love2;
love2:=930335-love3;
love3:=543661-love4;
love4:=543623-love1;
love1:=1328930 div love3;
love2:=930335 div love4;
love3:=543661 mod love4;
love4:=543623 div 9;



//------------------------------正常代码--------------------------------------//
//10111010 歌手名:谭咏麟 歌名:讲不出再见
vol_l:=50;
//初始音量
vol_r:=50;
//初始音量
currsong:=playing_song[0];
tstr:=currsong;
playing_song.Delete(0);
//的内存播放列表中删除一项
myplaylist.Items.Delete(0);
saveplaylist;
selectchang;
crystr:=copy(inttostr(love4)+inttostr(love4)+inttostr(love1)+inttostr(love3),1,4);
while length(crystr)>5do

begin

crystr:=crystr+inttohex(random(16),2);
end;

tsongid:='1'+copy(tstr,1,pos(' ',tstr)-1)+crystr;
end;

2:begin
//迷惑分支2
//10111010 歌手名:谭咏麟 歌名:讲不出再见
vol_l:=50;
//初始音量
vol_r:=50;
//初始音量
currsong:=playing_song[0];
tstr:=currsong;
playing_song.Delete(0);
//的内存播放列表中删除一项
myplaylist.Items.Delete(0);
saveplaylist;
selectchang;
crystr:=copy(inttostr(love4)+inttostr(love4)+inttostr(love1)+inttostr(love3),1,4);
while length(crystr)>5do

begin

crystr:=crystr+inttohex(random(16),2);
end;

tsongid:='2'+copy(tstr,1,pos(' ',tstr)-1)+crystr;
end;

3:begin
//迷惑分支3
//10111010 歌手名:谭咏麟 歌名:讲不出再见
vol_l:=50;
//初始音量
vol_r:=50;
//初始音量
currsong:=playing_song[0];
tstr:=currsong;
playing_song.Delete(0);
//的内存播放列表中删除一项
myplaylist.Items.Delete(0);
saveplaylist;
selectchang;
crystr:=copy(inttostr(love4)+inttostr(love4)+inttostr(love1)+inttostr(love3),1,4);
while length(crystr)>5do

begin

crystr:=crystr+inttohex(random(16),2);
end;

tsongid:='3'+copy(tstr,1,pos(' ',tstr)-1)+crystr;
end;

0:begin
//迷惑分支4
//10111010 歌手名:谭咏麟 歌名:讲不出再见
vol_l:=50;
//初始音量
vol_r:=50;
//初始音量
currsong:=playing_song[0];
tstr:=currsong;
playing_song.Delete(0);
//的内存播放列表中删除一项
myplaylist.Items.Delete(0);
saveplaylist;
selectchang;
crystr:=copy(inttostr(love4)+inttostr(love4)+inttostr(love1)+inttostr(love3),1,4);
while length(crystr)>5do

begin

crystr:=crystr+inttohex(random(16),2);
end;

tsongid:='4'+copy(tstr,1,pos(' ',tstr)-1)+crystr;
end;

end;


case copy(tsongid,1,1)[1] of
'1':begin

tsongid:=copy(tsongid,2,length(tsongid)-1-4);
end;

'2':begin

tsongid:=copy(tsongid,2,length(tsongid)-1-4);
end;

'3':begin

tsongid:=copy(tsongid,2,length(tsongid)-1-4);
end;

'4':begin

tsongid:=copy(tsongid,2,length(tsongid)-1-4);
end;

end;

with dm.my_quydo

begin

close;
sql.clear;
sql.add('select * from 歌曲 where id='+tsongid);
open;
if recordcount>0 then

begin

tsong_name:=fieldbyname('歌名').asstring;
tplayer_name:=fieldbyname('歌手姓名').asstring;
tsongpath:=fieldbyname('路径').asstring;
tsongsoundpath:=fieldbyname('声道').asinteger;
vol_l:=fieldbyname('左声音大小').asinteger;
vol_r:=fieldbyname('右声音大小').asinteger;
brightness:=fieldbyname('亮度').asinteger;
contrast:=fieldbyname('对比度').asinteger;
saturation:=fieldbyname('饱和度').asinteger;
now_play_type:=fieldbyname('类型').asinteger;
tdbsongpath :=tsongsoundpath;
end;

end;

if if_net_err then

addmemo('没有联接网络')
else

if not fileexists(getpath(tsongpath)) then

begin

addmemo('在网络上没有本歌曲:'+getpath(tsongpath));
// showmag('本歌曲路径没找到:'+copy(tstr,pos('路径:', tstr)+5,pos('声道:', tstr)-pos('路径:', tstr)-7));
// exit;
end;

brightness:=brightness+tbrightness;
contrast:=contrast+tcontrast;
saturation:=saturation+tsaturation;
if brightness<100 then
brightness:=500;
if contrast<100 then
contrast:=500;
if saturation<100 then
saturation:=500;
pmyvol_l:=vol_l;
pmyvol_r:=vol_l;
vol_l:=round(pmyvol_l*tmyvol);
//低字为左声道
vol_r:=round(pmyvol_r*tmyvol);
//高字为右声道
if vol_r>pmyvol_r then
vol_r:=pmyvol_r;
if vol_l>pmyvol_l then
vol_l:=pmyvol_l;
if (dm.my_locate_conn.Connected) then

with dm.locate_quydo

begin

close;
sql.clear;
tsql:='select * from 歌曲 where 歌名='''+tsong_name+''' and 歌手姓名='''+tplayer_name+'''';
sql.add(tsql);
open;
first;
if recordcount>0 then

begin

if fileexists(fieldbyname('路径').AsString) then

begin

tsongpath:=fieldbyname('路径').AsString;
iflocatesong:=true;
// addmemo('在本地找到'+tsong_name+'歌手姓名='+tplayer_name+'路径为:'+tstr1+'并且在此路径找到节目');
// showplaystate(clskyblue,'本地播放');
end
else

begin

// addmemo('在本地数据库中找到'+tsong_name+'歌手姓名='+tplayer_name+'路径为:'+tstr1+',但未在此路径找到本节目');
exit;
end;

end
else

begin

// showplaystate(clskyblue,'远程播放');
end;

end;

timer2.Enabled :=false;
p0_l4.Tag :=p0_l3.Tag;
if ifOpenDVDDriver=false then

begin

showmag('打开DVD驱动出错,请重新启动计算机再试一次',false);
exit;
//在初始化时打开神龙DVD驱动出错,退出
end;

if (mystate=2)or(ghMPEGStream<>0) then
//如果已停止播放
begin

closestream( ghMPEGStream );
ghMPEGStream := 0;
end;

ifdisplaydemo:=false;
backgrou.Enabled :=false;
if not iflocatesong then
tsongpath:=getpath(tsongpath);
ghMPEGStream :=play(tsongpath);
if mysongpath then
select102(1033) else
select102(1034) ;
//转换在伴音i
errid:=addmemo('正在播放:'+tstr1+'-'+'左音量:'+inttostr(vol_l)+'右音量:'+inttostr(vol_r)+'亮度:'+inttostr(brightness)+'对比度:'+inttostr(contrast)+'饱和度:'+inttostr(saturation));

change_volume(ghMPEGStream,vol_l,vol_l);
change_Brightness(ghMPEGStream,brightness);
change_CONTRAST(ghMPEGStream,contrast);
change_SATURATION(ghMPEGStream,SATURATION);
mystate:=GetState(ghMPEGStream);
if mystate =0 then

begin

showstate('_3_',true);
end
else

begin

showstate('_3_',false);
end;

{ if skipkind then

gg.passnext(begin
skipfrm)
// seekme1(ghMPEGStream,begin
skipfrm) //配置文件里数据
else

gg.passnext(begin
f);
// seekme1(ghMPEGStream,begin
f);
//数据库里数据
}
// showmag('左音量:'+inttostr(vol_l)+'右音量:'+inttostr(vol_r)+'亮度:'+inttostr(brightness)+'对比度:'+inttostr(contrast)+'饱和度:'+inttostr(saturation));
APPLICATION.ProcessMessages;
except
exit;
end;


end;




procedure Tnsktv.downme;
//NT关机准备函数
function SetPrivilege(sPrivilegeName : string;bEnabled : boolean ): boolean;
var
TPPrev,TP : TTokenPrivileges;
Token : THandle;
dwRetLen : DWord;
begin

Result := False;
OpenProcessToken(GetCurrentProcess,TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY,Token);
TP.PrivilegeCount:=1;
if( LookupPrivilegeValue(Nil,PChar( sPrivilegeName ),TP.Privileges[ 0 ].LUID ))then

begin

if( bEnabled )then
//Give this privileges
begin

TP.Privileges[ 0 ].Attributes := SE_PRIVILEGE_ENABLED;
end
else
begin
//NOT Give this privileges
TP.Privileges[ 0 ].Attributes := 0;
end;

dwRetLen := 0;
//enables or disables privileges in the specified access token.
Result := AdjustTokenPrivileges(Token,False,TP,SizeOf( TPPrev ),TPPrev,dwRetLen);
end;

CloseHandle( Token );
end;


//NT关机函数
function WinExitInNT( iFlags : integer ) : boolean;
begin

Result := True;
if( SetPrivilege( 'SeShutdownPrivilege',True ) )then

begin

if( not ExitWindowsEx( iFlags,0 ) )then

begin

Result := False;
end;

SetPrivilege( 'SeShutdownPrivilege',False )
end
else
begin

// handle errors...
Result := False;
end;

end;


begin

playing_song.clear;
myplaylist.clear;
nsktv.OnCloseQuery:=nil;
// win9x
if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then

ExitWindowsEx(EWX_FORCE+EWX_SHUTDOWN+EWX_POWEROFF,32);
// winNT
if Win32Platform = VER_PLATFORM_WIN32_NT then

WinExitInNT(EWX_FORCE+EWX_SHUTDOWN+EWX_POWEROFF);
end;




procedure Tnsktv.Timer3Timer(Sender: TObject);
var
mystate:integer;
//当前播放状态
cur_pos,all_pos,skip_pos:integer;
begin

if ifdisplaydemo then
exit;
{
PAUSED 0;
STOPPED 1;
PLAYING 2;
SEEKING 3;
STEPPING 4;
CLOSED 5;
READY 6;
}

//ifplaying 为 2 时为正在播放 为 1 时为已播放完
if ghmpegstream<>0 then
//正在播放
begin

mystate:=GetState(ghMPEGStream);
//得到驱动现在的状态
//----------以下是跳过尾数N祯的代码,endskipfrm为祯数,endskipfrm参数在nsvod.ini中 [system] endskipfrm=1000
if(mystate=2) then

begin

cur_pos:=position_my(ghMPEGStream);
all_pos:=get_mylength(ghMPEGStream);
skip_pos:=all_pos-endskipfrm;
if skip_pos<0 then
skip_pos:=10;
if(cur_pos>=skip_pos) then

begin

closestream(ghMPEGStream);
ghMPEGStream:=0;
end;

end;

if mystate=1 then
//如果已停止播放
begin

closestream(ghMPEGStream);
//关闭流
ghMPEGStream:= 0;
timer2.Enabled :=true;
backgrou.Enabled :=true;
end
else

backgrou.Enabled :=false;
end
else

begin

timer2.Enabled :=true;
backgrou.Enabled :=true;
end;

end;


procedure Tnsktv.p92_l5Click(Sender: TObject);
begin

select102(1035);
end;


procedure Tnsktv.p92_l6Click(Sender: TObject);
begin

select102(1036);
end;


procedure Tnsktv.p21_l1Click(Sender: TObject);
begin

select21(1031);
end;


procedure Tnsktv.p21_l2Click(Sender: TObject);
begin

select21(1032);
end;


procedure Tnsktv.p21_l3Click(Sender: TObject);
begin

select21(1033);
end;


procedure Tnsktv.p21_l4Click(Sender: TObject);
begin


select21(1034);
end;


procedure Tnsktv.p21_l5Click(Sender: TObject);
begin

select21(1035);
end;


procedure Tnsktv.p21_l9Click(Sender: TObject);
begin

select21(1039);
end;


procedure Tnsktv.p21_l0Click(Sender: TObject);
begin

select21(1030);
end;


procedure Tnsktv.p21_l8Click(Sender: TObject);
begin

select21(1038);
end;


procedure Tnsktv.p21_l7Click(Sender: TObject);
begin

select21(1037);
end;


procedure Tnsktv.p21_l6Click(Sender: TObject);
begin

select21(1036);
end;


procedure Tnsktv.p22_l1Click(Sender: TObject);
begin

select22(1031);
end;


procedure Tnsktv.p22_l2Click(Sender: TObject);
begin

select22(1032);
end;


procedure Tnsktv.p22_l3Click(Sender: TObject);
begin

select22(1033);
end;


procedure Tnsktv.p22_l4Click(Sender: TObject);
begin

select22(1034);
end;


procedure Tnsktv.p22_l8Click(Sender: TObject);
begin

select22(1038);
end;


procedure Tnsktv.p22_l9Click(Sender: TObject);
begin

select22(1039);
end;


procedure Tnsktv.p22_l0Click(Sender: TObject);
begin

select22(1030);
end;


procedure Tnsktv.p22_l7Click(Sender: TObject);
begin

select22(1037);
end;


procedure Tnsktv.p22_l6Click(Sender: TObject);
begin

select22(1036);
end;


procedure Tnsktv.p22_l5Click(Sender: TObject);
begin

select22(1035);
end;



procedure Tnsktv.p92_l0MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
begin

if button=mbRight then
close;
end;


procedure Tnsktv.p11_l1Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select11(1031);
enableok(oldpan,true);
end;


procedure Tnsktv.p11_l2Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select11(1036);
enableok(oldpan,true);
end;


procedure Tnsktv.p11_l3Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select11(1033);
enableok(oldpan,true);
end;


procedure Tnsktv.p11_l4Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select11(1037);
enableok(oldpan,true);
end;


procedure Tnsktv.p11_l9Click(Sender: TObject);
begin

select11(1039);
end;


procedure Tnsktv.p11_l8Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select11(1039);
enableok(oldpan,true);
end;


procedure Tnsktv.p11_l7Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select11(1034);
enableok(oldpan,true);
end;


procedure Tnsktv.p11_l6Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select11(1038);
enableok(oldpan,true);
end;


procedure Tnsktv.p11_l5Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select11(1032);
enableok(oldpan,true);
end;


procedure Tnsktv.p34_l1Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select34(1031);
enableok(oldpan,true);
end;


procedure Tnsktv.p34_l0Click(Sender: TObject);
begin

select34(1030);
end;


procedure Tnsktv.p34_l2Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select34(1032);
enableok(oldpan,true);
end;


procedure Tnsktv.p34_l3Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select34(1033);
enableok(oldpan,true);
end;


procedure Tnsktv.p34_l4Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select34(1034);
enableok(oldpan,true);
end;


procedure Tnsktv.p35_l8Click(Sender: TObject);
begin

select35($3A);
end;


procedure Tnsktv.p35_l9Click(Sender: TObject);
begin

select35($3B);
end;


procedure Tnsktv.p90_l4Click(Sender: TObject);
begin

p90_l4.OnClick:=nil;
select90(1034);
p90_l4.OnClick:=p90_l4Click;
end;


procedure Tnsktv.p90_l3Click(Sender: TObject);
begin

p90_l3.OnClick:=nil;
select90(1033);
p90_l3.OnClick:=p90_l3Click;
end;


procedure Tnsktv.p90_l2Click(Sender: TObject);
begin

p90_l2.OnClick:=nil;
select90(1032);
p90_l2.OnClick:=p90_l2Click;
end;


procedure Tnsktv.p90_l6Click(Sender: TObject);
begin

p90_l6.OnClick:=nil;
select90(1036);
p90_l6.OnClick:=p90_l6Click;
end;


procedure Tnsktv.p90_l1Click(Sender: TObject);
begin

p90_l1.OnClick:=nil;
select90(1031);
p90_l1.OnClick:= p90_l1Click;
end;


procedure Tnsktv.p90_l5Click(Sender: TObject);
begin

p90_l5.OnClick:=nil;
select90(1035);
p90_l5.OnClick:=p90_l5Click;
end;


procedure Tnsktv.P93_l3Click(Sender: TObject);
begin

p90_l3.OnClick:=nil;
select93(1033);
p90_l3.OnClick:=p90_l3Click;
end;


procedure Tnsktv.P93_l2Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select93(1032);
enableok(oldpan,true);
end;


procedure Tnsktv.P93_l1Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select93(1031);
enableok(oldpan,true);
end;


procedure Tnsktv.P93_l0Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select93(1030);
enableok(oldpan,true);
end;


procedure Tnsktv.p36_l1Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select36(1031);
enableok(oldpan,true);
end;


procedure Tnsktv.p36_l3Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select36(1033);
enableok(oldpan,true);
end;


procedure Tnsktv.p36_l5Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select36(1034);
enableok(oldpan,true);
end;


procedure Tnsktv.p36_l2Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select36(1032);
enableok(oldpan,true);
end;


procedure Tnsktv.p36_l4Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select36(1032);
enableok(oldpan,true);
end;


procedure Tnsktv.p36_l0Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select36(1030);
enableok(oldpan,true);
end;


procedure Tnsktv.P93_l9Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select93(1039);
enableok(oldpan,true);
end;


procedure Tnsktv.p0_l6Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
p0_l6.tag:=1;
nowplay_0.Tag:=1;
select0(1034);
enableok(oldpan,true);
end;


procedure Tnsktv.p0_l7Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
showok(22);
enableok(oldpan,true);
end;


procedure Tnsktv.P93_l7Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select93(1037);
enableok(oldpan,true);
end;


procedure Tnsktv.P93_l8Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select93(1038);
enableok(oldpan,true);
end;



function Tnsktv.sendmag(mag:string;ip:string):boolean;
var
MyStream: TMemoryStream;
tstr:string;
begin

result:=false;
with sendudpdo

begin

if ip='' then
RemoteHost := allip else
remotehost:=ip;
ReportLevel := Status_Basic;
Remoteport:=8108;
MyStream := TMemoryStream.Create;
tstr:=mag;
tstr:=DenCrypt('_'+mag,'');
try
MyStream.Write(tstr[1], Length(tstr));
SendStream(MyStream);
result:=true;
except
result:=false;
end;

MyStream.Free;
end;

end;


procedure Tnsktv.FormActivate(Sender: TObject);
var
mypath:string;
t:integer;
renumb_t,renumb_l:pchar;
myinifilepath:pchar;
tifautoResolution:pchar;
begin

inikeybored(kb_sel,kb_exit,kb_Return,kb_Play,kb_Pause,kb_Priority,kb_Pgup,kb_Pgdown,kb_Next,kb_Last,kb_Channel_1,kb_Channel_2,kb_Channel,kb_NextSong,
kb_Clear,kb_Del,kb_enter,kb_Num0,kb_Num1,kb_Num2,kb_Num3,kb_Num4,kb_Num5,kb_Num6,kb_Num7,kb_Num8,kb_Num9,
kb_left,kb_right,kb_up,kb_down,kb_Volup, kb_Voldown,kb_menu,kb_Service,kb_replay);

getmem(renumb_t,20);
getmem(renumb_l,20);
getmem(tifautoResolution,20);
getmem(myinifilepath,255);
myinifilepath:=pchar(ExtractFilePath(paramstr(0))+'nsvod.ini');
mypath:=ExtractFilePath(paramstr(0));
GetPrivateProfileString('system', 'ifautoResolution','0',tifautoResolution,20,myinifilepath);
OldResolution:=screen.Width;
//改变前的分辨率
OldFreqency:=GetScreenFreqency;
p90_lp1.left:=205;
p90_lp1.Top:=46;
//禁止改变分辩率
if tifautoResolution='1' then

begin

SetScreenResolution(640,480,OldFreqency);
SystemParametersInfo(SPI_SETFASTTASKSWITCH, 1, @t, 0);
//不能用屏幕保护
// SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, @t, 0);
//不能用系统键
hideTaskbar();
//隐藏
end;


while(formatdatetime('MM',now)>'56')do
application.processMessages;
sendmag('T'+formatdatetime('yyyymmddhhMM',now),songservernow);
with p00 do

begin

Left:=0;
top:=0;//lmknow.Height;
Width :=640;
//screen.Width;
Height:=545;
end;



with p0_i1do

begin

left:=0;
top:=0;
// align:=alClient;
// stretch:=true;
loadpict(p0_i1,'main');
end;




GetPrivateProfileString('skin', '00_1t', '-100',renumb_t,20,myinifilepath);
GetPrivateProfileString('skin', '00_1l', '-100',renumb_l,20,myinifilepath);
with p0_l1do

if (renumb_t='-100') or (renumb_l='-100') then

begin

end
else

begin

top:=strtoint(renumb_t);
left:=strtoint(renumb_l);
end;


GetPrivateProfileString('skin', '00_2t', '-100',renumb_t,20,myinifilepath);
GetPrivateProfileString('skin', '00_2l', '-100',renumb_l,20,myinifilepath);
with p0_l2do

if (renumb_t='-100') or (renumb_l='-100') then

begin

end
else

begin

top:=strtoint(renumb_t);
left:=strtoint(renumb_l);
end;



GetPrivateProfileString('skin', '00_3t', '-100',renumb_t,20,myinifilepath);
GetPrivateProfileString('skin', '00_3l', '-100',renumb_l,20,myinifilepath);
with p0_l3do

if (renumb_t='-100') or (renumb_l='-100') then

begin

end
else

begin

top:=strtoint(renumb_t);
left:=strtoint(renumb_l);
end;


GetPrivateProfileString('skin', '00_4t', '-100',renumb_t,20,myinifilepath);
GetPrivateProfileString('skin', '00_4l', '-100',renumb_l,20,myinifilepath);
with p0_l4do

if (renumb_t='-100') or (renumb_l='-100') then

begin

end
else

begin

top:=strtoint(renumb_t);
left:=strtoint(renumb_l);
end;

while(formatdatetime('MM',now)>'56')do
application.processMessages ;

sendmag('T'+formatdatetime('yyyymmddhhMM',now),songservernow);
//myselectpoint:=32;
//sendmag('&'+Decrypt(getid1(getmacid(0)),1),songservernow);

GetPrivateProfileString('skin', '00_5t', '-100',renumb_t,20,myinifilepath);
GetPrivateProfileString('skin', '00_5l', '-100',renumb_l,20,myinifilepath);
with p0_l5do

if (renumb_t='-100') or (renumb_l='-100') then

begin

end
else

begin

top:=strtoint(renumb_t);
left:=strtoint(renumb_l);
end;


GetPrivateProfileString('skin', '00_6t', '-100',renumb_t,20,myinifilepath);
GetPrivateProfileString('skin', '00_6l', '-100',renumb_l,20,myinifilepath);
with p0_l6do

if (renumb_t='-100') or (renumb_l='-100') then

begin

end
else

begin

top:=strtoint(renumb_t);
left:=strtoint(renumb_l);
end;

GetPrivateProfileString('skin', '00_7t', '-100',renumb_t,20,myinifilepath);
GetPrivateProfileString('skin', '00_7l', '-100',renumb_l,20,myinifilepath);
with p0_l7do

if (renumb_t='-100') or (renumb_l='-100') then

begin

end
else

begin

top:=strtoint(renumb_t);
left:=strtoint(renumb_l);
end;


GetPrivateProfileString('skin', '00_8t', '-100',renumb_t,20,myinifilepath);
GetPrivateProfileString('skin', '00_8l', '-100',renumb_l,20,myinifilepath);
with p0_l8do

if (renumb_t='-100') or (renumb_l='-100') then

begin

end
else

begin

top:=strtoint(renumb_t);
left:=strtoint(renumb_l);
end;

//inc(myselectpoint);
while(formatdatetime('MM',now)>'56')do
application.processMessages ;
;

sendmag('T'+formatdatetime('yyyymmddhhMM',now),songservernow);
end;


procedure Tnsktv.p34_l5Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select34(1035);
enableok(oldpan,true);
end;


procedure Tnsktv.p34_l6Click(Sender: TObject);
begin

select34(1036);
end;


procedure Tnsktv.p102_l1Click(Sender: TObject);
begin

if ifdisplaydemo=true then
exit;
select102(1031);
//allselect(lm_Volup);
//加大音量
end;


procedure Tnsktv.p102_l2Click(Sender: TObject);
begin

if ifdisplaydemo=true then
exit;
//allselect(lm_Voldown);
//减小音量
select102(1032);
end;


procedure Tnsktv.p102_l3Click(Sender: TObject);
begin

select102(1038);
//下一首歌曲
//allselect(lm_NextSong);
end;


procedure Tnsktv.p102_l5Click(Sender: TObject);
begin

select102(1036);
//allselect(lm_Next);
//快进
end;


procedure Tnsktv.p102_l9Click(Sender: TObject);
begin

p0_l8Click(Sender);
//allselect(lm_Priority);
//优先
end;


procedure Tnsktv.p102_l4Click(Sender: TObject);
begin

select102(1035);
//allselect(lm_Last);
//快退
end;



procedure Tnsktv.p102_l6Click(Sender: TObject);
begin

allselect(lm_menu);
end;


procedure Tnsktv.P93_l4Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select93(1034);
enableok(oldpan,true);
end;




procedure Tnsktv.Timer6Timer(Sender: TObject);
begin

changskin(0);
end;


procedure Tnsktv.p102_l8Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
allselect(lm_PgDn);
enableok(oldpan,true);
end;


procedure Tnsktv.p102_l7Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
case pressit(12)+myselectpoint of
90:begin

select90(1030);
enableok(oldpan,true);
exit;
end;

91:begin

p91_l0Click(nil);
enableok(oldpan,true);
exit;
end;

21:begin

if_del_pre:=0;
returnone;
end
else

returnone;
end;

edit1.text:='';
my_enter_py.Caption :='';
enableok(oldpan,true);
end;




procedure Tnsktv.word_sql_player(sender:TObject);
begin

mysql.player_name_sx:=copy((sender as Timage).Name,6,1);
myselectpy.caption:=uppercase(mysql.player_name_sx);
sqlplayer;
end;



procedure Tnsktv.numbsqlsong(mykey:string);
var
wordnumb:string;
begin

if sqlnow then
exit;
wordnumb:=mykey;
if mysql.tsql<>'' then

begin

mysql.tsql:='select top 600 id,编号,歌手姓名,歌名,类别,拼音缩写,路径,声道,类型,排行,歌名字数,语种,歌手性别,(左声音大小+1) AS 左声音大小,(右声音大小+1) AS 右声音大小,(亮度+1) AS 亮度,';
if wordnumb='A' then

mysql.tsql:=mysql.tsql+'(对比度+1) AS 对比度,(饱和度+1) AS 饱和度,(开始地+1) AS 开始地,(终止地+1) AS 终止地 from 歌曲 where 歌名字数>=16 and id in (select top 600 id from 歌曲 order by 排行 desc)order by 排行 asc'
else

if wordnumb='B' then

mysql.tsql:=mysql.tsql+'(对比度+1) AS 对比度,(饱和度+1) AS 饱和度,(开始地+1) AS 开始地,(终止地+1) AS 终止地 from 歌曲 where id in (select top 600 id from 歌曲 order by 排行 desc)order by 排行 asc'
else

mysql.tsql:=mysql.tsql+'(对比度+1) AS 对比度,(饱和度+1) AS 饱和度,(开始地+1) AS 开始地,(终止地+1) AS 终止地 from 歌曲 where 歌名字数='+wordnumb+' and id in (select top 600 id from 歌曲 order by 排行 desc)order by 排行 asc';
end
else

if wordnumb='A' then

mysql.song_numb:='900'
else

if wordnumb='B' then

mysql.song_numb:='999'
else

mysql.song_numb:=wordnumb;
if commandlist.Strings[commandlist.Count-1]<>'35' then
mysql.py_sx:='';
sqlsong(true);
end;


procedure Tnsktv.numbsqlsong_1(sender:TObject);
var
wordnumb:string;
begin

if sqlnow then
exit;
arrow3.Visible:=false;
arrow4.Visible:=true;
wordnumb:=copy((sender as timage).name,3,1);
case chr(ord(wordnumb[1])+myselectpoint) of
'1':arrow4.Top:=54;
'2':arrow4.Top:=95 ;
'3':arrow4.Top:=127;
'4':arrow4.Top:=166;
'5':arrow4.Top:=204;
'6':arrow4.Top:=238;
'7':arrow4.Top:=274;
'8':arrow4.Top:=311;
'9':arrow4.Top:=348;
'B':arrow4.Top:=385 ;
end;

numbsqlsong(wordnumb);
end;


procedure Tnsktv.puaseClick(Sender: TObject);
begin

select102(1037);
end;


procedure Tnsktv.p92_l2Click(Sender: TObject);
begin

select92(1031);
end;


procedure Tnsktv.p92_l1Click(Sender: TObject);
begin

select92(1032);
end;


procedure Tnsktv.p102_l10Click(Sender: TObject);
begin

select102(1033);
//allselect(lm_Channel);
//切换声道
end;


procedure Tnsktv.replayClick(Sender: TObject);
begin

select102(1039);
end;


procedure Tnsktv.p102_l11Click(Sender: TObject);
begin

select102(1034);
end;


procedure Tnsktv.myplaylistClick(Sender: TObject);
var
myselect:integer;
tstr1,tstr2:string;
begin

case if_del_pre+myselectpoint of
0:begin

end;

1:begin

try
if (myplaylist.ItemIndex<0)or(myplaylist.items.Count<1) then
exit;
// if songlist=nil then
exit;
playing_song.Delete(myplaylist.ItemIndex);
myplaylist.Items.Delete(myplaylist.ItemIndex);
selectchang;
except
end;

end;

2:begin

try
if (myplaylist.ItemIndex<0)or(myplaylist.items.Count<1) then
exit;
// if songlist=nil then
exit;
myselect:=myplaylist.ItemIndex;
tstr1:=myplaylist.Items.Strings[myselect];
myplaylist.Items.Delete(myselect);
myplaylist.Items.Insert(0,tstr1);
tstr1:=playing_song.Strings[myselect];
playing_song.Delete(myselect);
playing_song.Insert(0,tstr1);
selectchang;
except
end;


end;

end;

end;


procedure Tnsktv.pre_songClick(Sender: TObject);
begin

select102($3D);
end;


procedure Tnsktv.del_songClick(Sender: TObject);
begin

select102($3C);
end;


procedure Tnsktv.man_playClick(Sender: TObject);
begin

mysql.player_name_sx:='';
mysql.player_sex:='男';
sqlplayer;
end;


procedure Tnsktv.woman_playClick(Sender: TObject);
begin

mysql.player_name_sx:='';
mysql.player_sex:='女';
sqlplayer;
end;


procedure Tnsktv.sql_word_song(Sender: TObject);
var
oldpan,tint1,tint2:integer;
tstr:string;
begin

if iflockme=false then

begin

if ghMPEGStream<>0 then

begin

closedrv(ghMPEGStream);
ghMPEGStream:=0;
end;

// showmag('对不起,本包箱已被管理员封闭');
exit ;
end;

oldpan:=pressit(12);
arrow3.Visible:=true;
arrow4.Visible:=false;
enableok(oldpan,false);
mysql.py_sx:=copy((sender as timage).Name,8,1);
case chr(ord(upcase(mysql.py_sx[1]))+myselectpoint) of
'A':arrow3.Left:=58;
'B':arrow3.Left:=80;
'C':arrow3.Left:=105;
'D':arrow3.Left:=124;
'E':arrow3.Left:=145;
'F':arrow3.Left:=166;
'G':arrow3.Left:=182;
'H':arrow3.Left:=203;
'I':arrow3.Left:=223;
'J':arrow3.Left:=240;
'K':arrow3.Left:=260;
'L':arrow3.Left:=280;
'M':arrow3.Left:=300;
'N':arrow3.Left:=322;
'O':arrow3.Left:=345;
'P':arrow3.Left:=366;
'Q':arrow3.Left:=390;
'R':arrow3.Left:=410;
'S':arrow3.Left:=428;
'T':arrow3.Left:=451;
'U':arrow3.Left:=472;
'V':arrow3.Left:=491;
'W':arrow3.Left:=515;
'X':arrow3.Left:=537;
'Y':arrow3.Left:=557;
'Z':arrow3.Left:=580;
end;

if p0_l6.tag=1 then

begin

tint1:=pos('歌名字数=',mysql.tsql);
if tint1>0 then

begin

tstr:=copy(mysql.tsql,tint1+9,500);
tint2:=pos(' ',tstr);
if tint2=0 then

delete(mysql.tsql,tint1+10,1000)
else

delete(mysql.tsql,tint1,9+tint2);
tint1:=pos('where and',mysql.tsql);
if tint1>0 then
delete(mysql.tsql,tint1+6,3);
end;


tint1:=pos('拼音缩写 like ''',mysql.tsql);
if tint1>0 then

begin

delete(mysql.tsql,tint1+15,1);
insert(mysql.py_sx,mysql.tsql,tint1+15 );
end
else

begin

tint1:=pos('where ',mysql.tsql);
tstr:=copy(mysql.tsql,tint1+7,500);
tint2:=pos(' ',tstr);
delete(mysql.tsql,tint1+8,tint2-tint1);
insert('拼音缩写 like '''+mysql.py_sx+'%'' and ',mysql.tsql,tint1+6);
end;

end;

//if arrow4.Visible then
mysql.song_numb:='';
mysql.song_numb:='';
sqlsong(true);
enableok(oldpan,true);
end;




procedure Tnsktv.Timer1Timer(Sender: TObject);
begin

if iflockme=false then

begin

if ghMPEGStream<>0 then

begin

closedrv(ghMPEGStream);
ghMPEGStream:=0;
end;

// showmag('对不起,本包箱已被管理员封闭');
exit ;
end;

//if edit1.caption<>edit1.hint then

// begin

// edit1.hint:=edit1.caption;
// timer4.Enabled :=false;
// timer4.Enabled :=true;
// end;

end;


procedure Tnsktv.p92_EClick(Sender: TObject);
begin

select102($3E);
end;


procedure Tnsktv.p92_FClick(Sender: TObject);
begin

select102($3F);
end;


procedure Tnsktv.Image27Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select93(1035);
enableok(oldpan,true);
end;


procedure Tnsktv.Image23Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select11(1035);
enableok(oldpan,true);
end;


procedure Tnsktv.p11_lAClick(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
select11(1030);
//select11($3A);
enableok(oldpan,true);
end;


procedure Tnsktv.backgrouTimer(Sender: TObject);
var
mystate:integer;
//当前播放状态
begin

if iflockme=true then

begin

if ghMPEGStream<>0 then

begin

closedrv(ghMPEGStream);
ghMPEGStream:=0;
end;

showmag('对不起,本包箱已被管理员封闭',false);
exit ;
end;

mystate:=GetState(ghMPEGStream);
if (mystate=1)or(mystate=-1)or(mystate=5)or(mystate=6) then
//如果没有播放任何文件
begin

ifdisplaydemo:=false;
Timer2.Enabled:=true;
end
else

if((mystate=2)or(mystate=3)or(mystate=4))and(ifdisplaydemo=true) then
//正在播放背景广告
begin

Timer2.Enabled :=true;
exit;
end
else

exit;
if (mystate<>2)and(ifdisplaydemo=false) then

begin

if (playing_song.count>0) then
exit;
closestream(ghMPEGStream );
//关闭流
ghMPEGStream := 0;
ifdisplaydemo:=true;
showplaystate('请选择歌曲','未选歌曲 ');
ghMPEGStream :=play(playbackgrouplaylist(backgrouplaylist));
change_volume(ghMPEGStream,advol,advol);
if ghMPEGStream=0 then
ifdisplaydemo:=false;
end;

end;


procedure Tnsktv.return35Click(Sender: TObject);
begin

p102_l6Click(nil);
edit1.text:='';
my_enter_py.Caption :='';
end;


procedure Tnsktv.all_playerClick(Sender: TObject);
begin

mysql.player_name_sx:='';
mysql.player_sex:='';
sqlplayer;
end;


procedure Tnsktv.return91Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
case pressit(12)+myselectpoint of
90:begin

// returnone;
select90(1030);
// p90_l9.Tag:=1;
enableok(oldpan,true);
exit;
end;

91:begin

if return91.tag=1 then

begin

return91.tag:=0;
Clsmysql;
showok(0);
end
else

begin

returnone;
end;

enableok(oldpan,true);
exit;
end;

21:begin

if_del_pre:=0;
returnone;
end
else

returnone;
end;

edit1.text:='';
my_enter_py.Caption :='';

enableok(oldpan,true);
end;


procedure Tnsktv.return90Click(Sender: TObject);
var
oldpan:integer;
begin

oldpan:=pressit(12);
enableok(oldpan,false);
case pressit(12)+myselectpoint of
90:begin

returnone;
mysql.song_numb:='';
mysql.py_sx:='';
nowplay_0.Tag:=1;
p0_l6.tag:=0;
enableok(oldpan,true);
exit;
end;

91:begin

p91_l0Click(nil);
enableok(oldpan,true);
exit;
end;

21:begin

if_del_pre:=0;

returnone;
end
else

returnone;
end;

edit1.text:='';
my_enter_py.Caption :='';

enableok(oldpan,true);
end;


procedure Tnsktv.Image10MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
begin

if button=mbRight then

if messagebox(0,'是否真的要关闭计算机?','提示',mb_yesno)=idyes then

if ifexit then

begin

if ghMPEGStream<>0 then

begin

closestream( ghMPEGStream );
ghMPEGStream := 0;
end;

deletefile(ExtractFilePath(paramstr(0))+'playlist.lst');
ExitWindowsEx(EWX_SHUTDOWN, 0);
// winexec(pchar(ExtractFilePath(paramstr(0))+'autodown.exedo
wnme'),SW_SHOWNORMAL);
end;

end;


procedure Tnsktv.py_songlistKeyUp(Sender: TObject;
var Key: Word;
Shift: TShiftState);
begin

key:=0;
end;


procedure Tnsktv.py_songlistKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
begin

key:=0;
end;


procedure Tnsktv.py_songlistKeyPress(Sender: TObject;
var Key: Char);
begin

key:=#0;
end;


procedure Tnsktv.myplaylistKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
begin

if key=lm_Pgup then
p92_EClick(nil);
if key=lm_Pgdn then
p92_FClick(nil);
key:=0;
end;


procedure Tnsktv.Timer4Timer(Sender: TObject);
var
oldpan:integer;
begin

timer4.Enabled :=false;
oldpan:=pressit(12);
enableok(oldpan,false);
case pressit(12)+myselectpoint of
91:begin
//歌手列表
sqlplayer;
end;

90:begin
//歌曲列表
if showmypos_pic.hint<>'-1' then
numbsqlsong(showmypos_pic.hint)else
sqlsong(true);
end;

35:begin

select35($3D);
end;

end;

enableok(oldpan,true);
end;



procedure Tnsktv.p0_l9Click(Sender: TObject);
begin

select0(1039);
//showok(22);
end;


procedure Tnsktv.p24_9Click(Sender: TObject);
var
tint:integer;
begin

tint:=tfirstword.IndexOf(p24_l1.Caption);
case tint+myselectpoint of
-1:showfirstword(1);
0:showfirstword(1);
15:showfirstword(1);
else

showfirstword((tint div 15))
end;

end;


procedure Tnsktv.p24_0Click(Sender: TObject);
var
tint:integer;
begin

tint:=tfirstword.IndexOf(p24_l1.Caption);
case tint+myselectpoint of
-1:showfirstword(1);
0:showfirstword(2);
else

if tint+15>tfirstword.count then
exit else
showfirstword((tint div 15)+2)
end;

end;


procedure Tnsktv.p24_l1Click(Sender: TObject);
var
tstr,myfirstword:string;
begin

tstr:=inttostr(pressit(12));
if commandlist.Count=0 then

commandlist.Add(tstr)
else

if commandlist.Strings[commandlist.Count-1]<>tstr then
commandlist.Add(tstr);
case (sender as Tyusoftlabel).top+myselectpoint of
101:arrow5.Top:=102;
186:arrow5.Top:=187;
269:arrow5.Top:=267;
end;

application.ProcessMessages;
myfirstword:=(sender as Tyusoftlabel).caption;
// sqlfirstword(myfirstword);
mysql.song_name:=myfirstword;
sqlsong(true);
end;


procedure Tnsktv.Image2Click(Sender: TObject);
begin

allselect(lm_Next);
end;


procedure Tnsktv.p0_l10Click(Sender: TObject);
begin

sqlfirstword('');
showfirstword(1);
showok(24);
end;


procedure Tnsktv.p24_iAClick(Sender: TObject);
var
tstr:string;
begin

tstr:=copy((sender as timage).Name ,6,1);
try
case chr(ord(upcase(tstr[1]))+myselectpoint) of
'A':arrow6.Left:=63;
'B':arrow6.Left:=83;
'C':arrow6.Left:=105;
'D':arrow6.Left:=126;
'E':arrow6.Left:=147;
'F':arrow6.Left:=170;
'G':arrow6.Left:=187;
'H':arrow6.Left:=213;
'I':arrow6.Left:=231;
'J':arrow6.Left:=250;
'K':arrow6.Left:=270;
'L':arrow6.Left:=294;
'M':arrow6.Left:=320;
'N':arrow6.Left:=349;
'O':arrow6.Left:=373;
'P':arrow6.Left:=395;
'Q':arrow6.Left:=412;
'R':arrow6.Left:=438;
'S':arrow6.Left:=459;
'T':arrow6.Left:=480;
'U':arrow6.Left:=499;
'V':arrow6.Left:=525;
'W':arrow6.Left:=546;
'X':arrow6.Left:=573;
'Y':arrow6.Left:=596;
'Z':arrow6.Left:=617;
end;

except
tstr:='';
end;

sqlfirstword(tstr);
showfirstword(1);
end;


procedure Tnsktv.showmypos_picClick(Sender: TObject);
begin

nsktv.showmypos.Visible :=false;
end;


procedure Tnsktv.Image20Click(Sender: TObject);
begin

aboutme_f:=Taboutme_f.create(application);
aboutme_f.showmodal;
aboutme_f.free;
end;


procedure Tnsktv.p35_lDClick(Sender: TObject);
begin

select35($3C);
end;


procedure Tnsktv.Image146Click(Sender: TObject);
begin

allselect(lm_enter);
end;


procedure Tnsktv.Image144Click(Sender: TObject);
begin

returnone;
end;


procedure Tnsktv.Image1DblClick(Sender: TObject);
begin

close;
end;


procedure Tnsktv.returnmeClick(Sender: TObject);
begin

if commandlist.Count>0 then

if commandlist.Strings[commandlist.Count-1]='24' then

begin

// clsmysql;
mysql.song_numb:='';
end;


returnone;
end;



procedure Tnsktv.inimousemove;
var
tint:integer;
begin

for tint:=0 to nsktv.ComponentCount-1do

begin

if(nsktv.Components[tint] is tpanel)then
tpanel(nsktv.Components[tint]).OnMouseMove:=FormMouseMove;
if(nsktv.Components[tint] is timage)then
timage(nsktv.Components[tint]).OnMouseMove:=FormMouseMove;
end;

end;


procedure Tnsktv.Timer5Timer(Sender: TObject);
var
handle:integer;
{变量}
begin

//ifmeitok('fdafd','fdafd');
if(mypos.x=mouse.CursorPos.x)and(mypos.y=mouse.CursorPos.y)then

begin

timer5.Enabled :=false;
handle:=findwindow('Tsaveme',nil);{查找是否有此类的窗体}
if (handle=0)and(ifshowdown=false) then

ShellExecute(handle,'open',pchar(ExtractFilePath(paramstr(0))+'/scrsave.exe'),nil,nil,SW_SHOW);
exit;
end
else

begin

mypos.x:=mouse.CursorPos.x;
mypos.y:=mouse.CursorPos.y;
end;


end;


procedure Tnsktv.FormMouseMove(Sender: TObject;
Shift: TShiftState;
X,
Y: Integer);
begin

timer5.Enabled :=false;
timer5.Enabled :=true;
end;


procedure Tnsktv.p90_i1MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
begin

if Button=mbRight then
returnmeClick(nil);
end;


procedure Tnsktv.closeme_butMouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
begin

if button=mbRight then

begin

close;
end;

end;


end.
 
不错,可以合作 QQ:52631212
 
合作什么?
 
这个MCI方式的,只能说可用,快过时了,是否有Directshow方式的,哪怕是简单的DEMO,
方便的话可否发邮件:yxm@fun.21cn.com,大家交流下.
 
无DLL源码??
 
哈哈,还是神龙卡播放的哈
 
呵呵
半开源
 
已经算是开源了哈,神龙卡的pas,网上多得很,不过神龙卡只有自己掏钱买了哈
 
VOD的开发根本不难 难度在于歌源及歌库
10000首歌的歌库光是拷贝到整理就不是一个人能承受得了的
我早已放弃了VOD的开发
 
多人接受答案了。
 

Similar threads

I
回复
0
查看
637
import
I
I
回复
0
查看
460
import
I
I
回复
0
查看
671
import
I
I
回复
0
查看
649
import
I
顶部