delphi 游戏菜单部分源码

    技术2022-05-11  70

    procedure prstart(new:bool); begin main.ListView1.BackPicture.Graphic:=nil; main.ListView2.BackPicture.Graphic:=nil; main.ListView3.BackPicture.Graphic:=nil; main.ListView4.BackPicture.Graphic:=nil; main.ListView5.BackPicture.Graphic:=nil; main.ListView6.BackPicture.Graphic:=nil; main.ListView7.BackPicture.Graphic:=nil; main.ListView8.BackPicture.Graphic:=nil; main.ListView9.BackPicture.Graphic:=nil; main.WGListView.BackPicture.Graphic:=nil; main.TabSheet1.Caption:=readinifile('设置','分组1名称','最新推荐'); main.TabSheet2.Caption:=readinifile('设置','分组2名称','网络游戏'); main.TabSheet3.Caption:=readinifile('设置','分组3名称','单机游戏'); main.TabSheet4.Caption:=readinifile('设置','分组4名称','私服专区'); main.TabSheet5.Caption:=readinifile('设置','分组5名称','休闲游戏'); main.TabSheet6.Caption:=readinifile('设置','分组6名称','电影音乐'); main.TabSheet7.Caption:=readinifile('设置','分组7名称','升级补丁'); main.TabSheet8.Caption:=readinifile('设置','分组8名称','游戏外挂'); main.TabSheet1.TabVisible:=readinifile('设置','显示分组1',true); main.TabSheet2.TabVisible:=readinifile('设置','显示分组2',true); main.TabSheet3.TabVisible:=readinifile('设置','显示分组3',true); main.TabSheet4.TabVisible:=readinifile('设置','显示分组4',true); main.TabSheet5.TabVisible:=readinifile('设置','显示分组5',true); main.TabSheet6.TabVisible:=readinifile('设置','显示分组6',true); main.TabSheet7.TabVisible:=readinifile('设置','显示分组7',true); main.TabSheet8.TabVisible:=readinifile('设置','显示分组8',true); main.SeathTab.TabVisible:=false; if fileexists(selfpath+'logo1.jpg') then main.logo1.Picture.LoadFromFile('logo1.jpg'); if fileexists(selfpath+'logo2.jpg') then main.logo2.Picture.LoadFromFile('logo2.jpg'); main.logoimage.Picture:=main.logo1.Picture; //if readinifile('设置','窗口最大',true) then main.WindowState:=wsMaximized; if readinifile('设置','作为桌面',true) then    begin     main.BorderStyle:=bsDialog; //   bsToolWindow     main.Align:=alClient;     Windows.SetParent(main.Handle, FindWindow('Progman', nil));    end else        begin         //ShowWindowAsync(Application.Handle,sw_show);         main.BorderStyle:=bsSizeable;         main.Align:=alNone;         Windows.SetParent(main.Handle, main.Handle);    end; NeedOutPass:=readinifile('设置','退出需要密码',true); pass:=myword(readinifile('设置','程序密码',''),''); if pass = '' then pass:='o123v123x123ssd13fer123zfxcow123e';    main.Panel1.Visible:=readinifile('设置','显示logo',true);   //@@ 免费功能不能用    main.MainPubPanel.Visible:=readinifile('设置','显示公告',true);     main.ListView9.Visible:=readinifile('设置','显示外挂',true); if  readinifile('设置','右边公告',true)  then     main.MainPubPanel.Align:=alRight else main.MainPubPanel.Align:=alLeft;     main.N10.Checked:=(main.MainPubPanel.Align=alRight); ServerIp  :=readinifile('设置','服务器IP','127.0.0.1');; ServerPort:=readinifile('设置','服务器端口',75601);; AutoUPgame:=readinifile('设置','询问更新游戏',true); AutoRePic :=readinifile('设置','自动刷新图标',false); netpath   :=readinifile('设置','网络更新',''); wguppath  :=readinifile('设置','外挂升级','');     setskin(readinifile('设置','程序外观',1)); UseBackPic:=readinifile('设置','启用背景',true); SjBackPic :=readinifile('设置','随机背景',true); main.Memo2.Lines.Text:=readinifile('设置','系统公告','未设置公告'); main.Memo3.Lines.Text:=readinifile('设置','最新更新','当前无更新'); setcolor(readinifile('设置','界面颜色',clWindow),readinifile('设置','界面字体颜色',clWindow)); LoadGameLabel(GameLabel); IPListSet1.NetName:=readinifile('设置','网关名称1',''); IPListSet1.NetIP  :=readinifile('设置','网关地址1',''); IPListSet1.NetSub :=readinifile('设置','子网掩码1',''); IPListSet1.aDNS   :=readinifile('设置','主DNS1',''); IPListSet1.bDNS   :=readinifile('设置','副DNS1',''); IPListSet2.NetName:=readinifile('设置','网关名称2',''); IPListSet2.NetIP  :=readinifile('设置','网关地址2',''); IPListSet2.NetSub :=readinifile('设置','子网掩码2',''); IPListSet2.aDNS   :=readinifile('设置','主DNS2',''); IPListSet2.bDNS   :=readinifile('设置','副DNS2',''); main.N_net1.Caption:=IPListSet1.NetName; main.N_net2.Caption:=IPListSet2.NetName; ToolsInfo.Tools1:=readinifile('工具设置','tools1',format('%stools/Grachics.lnk',[selfpath])); ToolsInfo.Show1 :=readinifile('工具设置','show1',true); ToolsInfo.Tools2:=readinifile('工具设置','tools2',format('%stools/IME.exe',[selfpath])); ToolsInfo.Show2 :=readinifile('工具设置','show2',true); ToolsInfo.Tools3:=readinifile('工具设置','tools3',format('%stools/key.lnk',[selfpath])); ToolsInfo.Show3 :=readinifile('工具设置','show3',true); ToolsInfo.Tools4:=readinifile('工具设置','tools4',format('%stools/mouse.lnk',[selfpath])); ToolsInfo.Show4 :=readinifile('工具设置','show4',true); ToolsInfo.Tools5:=readinifile('工具设置','tools5','C:/WINDOWS/system32/sndvol32.exe'); ToolsInfo.Show5 :=readinifile('工具设置','show5',true); ToolsInfo.Tools6:=readinifile('工具设置','tools6',''); ToolsInfo.Show6 :=readinifile('工具设置','show6',true); ToolsInfo.Tools7:=readinifile('工具设置','tools7',''); ToolsInfo.Show7 :=readinifile('工具设置','show7',true); PicIndex :=readinifile('设置','背景图片',0); randomize; if  SjBackPic then  PicIndex:=random(10); if fileexists(selfpath+'icolist.dat') then loadimagelist(selfpath+'icolist.dat') else  new:=true; if new then begin main.Imagelist2.Clear; loadallini; resavepic; GetSystemImageList(main.ImageList2); saveimagelist(selfpath+'icolist.dat'); end; main.Timer1.Enabled:=true; end; function ExecuteFile(const FileName, Params, DefaultDir: String; ShowCmd: Integer): THandle; var zFileName, zParams, zDir: array[0..79] of Char; begin try Result := ShellExecute(Application.MainForm.Handle, nil, StrPCopy(zFileName, FileName), StrPCopy(zParams, Params), StrPCopy(zDir, DefaultDir), ShowCmd); finally; end; end; function upexec(itemsx:Tlistitems;i:integer):bool; var exepath,uppath:string;  //源目录和目标目录 begin if i > -1 then begin uppath:=Itemsx.Item[i].SubItems[5]; exepath:=Itemsx.Item[i].SubItems[1]; if application.MessageBox(Pchar(format('要更新 %s 游戏吗 ? ',[Itemsx.Item[i].Caption])),'系统信息',MB_YESNO+MB_Iconquestion)=IDyes then if extractfileext(exepath)='' then begin if writetbq(exepath,uppath,Itemsx.Item[i].SubItems[0]) then Itemsx.Item[i].ImageIndex:=strtoint(Itemsx.Item[i].SubItems[4]); result:=true; end else begin   result:=true;   WinExec(pchar(exepath),SW_SHOWNORMAL);   Itemsx.Item[i].ImageIndex:=strtoint(Itemsx.Item[i].SubItems[4]);   end;   if Itemsx.Item[i].SubItems.Count = 6 then Itemsx.Item[i].SubItems.Append('NOGAMEUP'); end; end; function ExePathToDir(FilePath:string):string; begin if ExtractFileExt(FilePath)='.lnk' then begin result:=extractfiledir(GetLinkFullFileName(FilePath)); end else result:=extractfiledir(FilePath); end; procedure exectools(pathx:string); var exepath,path:string; begin begin exepath:=pathx; if not fileexists(exepath) then begin //application.MessageBox('指定的工具不存在 !',' 提示 ',mb_ok+MB_ICONINFORMATION); //exit; end; path:=ExePathToDir(exepath); ExecuteFile(exepath,'',path,SW_SHOWNORMAL); if isfree2 then   setgame.Free; end; end; Function UPGames:bool; begin with main do case page1.ActivePageIndex  of    0:  result:=upexec(listview1.Items,listview1.ItemIndex);    1:  result:=upexec(listview2.Items,listview2.ItemIndex);    2:  result:=upexec(listview3.Items,listview3.ItemIndex);    3:  result:=upexec(listview4.Items,listview4.ItemIndex);    4:  result:=upexec(listview5.Items,listview5.ItemIndex);    5:  result:=upexec(listview6.Items,listview6.ItemIndex);    6:  result:=upexec(listview7.Items,listview7.ItemIndex);    7:  result:=upexec(listview8.Items,listview8.ItemIndex);    8:  result:=upexec(listview9.Items,listview9.ItemIndex); end; end; procedure Tmain.ListView1DblClick(Sender: TObject); begin exec(listview1.Items,listview1.ItemIndex); end; procedure Tmain.ListView2DblClick(Sender: TObject); begin exec(listview2.Items,listview2.ItemIndex); end; procedure Tmain.N2Click(Sender: TObject); begin if application.MessageBox('要刷新所有项目的图标吗 , 此过程可能要几秒种 . ','系统信息',MB_YESNO+MB_Iconquestion)=IDyes then begin main.WGListView.Items.Clear; resavepic; GetSystemImageList(main.ImageList2); saveimagelist(selfpath+'icolist.dat'); end; end; procedure Tmain.N1Click(Sender: TObject); begin if page1.ActivePageIndex=0 then exec(listview1.Items,listview1.ItemIndex); if page1.ActivePageIndex=1 then exec(listview2.Items,listview2.ItemIndex); if page1.ActivePageIndex=2 then exec(listview3.Items,listview3.ItemIndex); if page1.ActivePageIndex=3 then exec(listview4.Items,listview4.ItemIndex); if page1.ActivePageIndex=4 then exec(listview5.Items,listview5.ItemIndex); if page1.ActivePageIndex=5 then exec(listview6.Items,listview6.ItemIndex); if page1.ActivePageIndex=6 then exec(listview7.Items,listview7.ItemIndex); if page1.ActivePageIndex=7 then exec(listview8.Items,listview8.ItemIndex); if page1.ActivePageIndex=8 then exec(listview9.Items,listview9.ItemIndex); end; procedure Tmain.ListView3DblClick(Sender: TObject); begin exec(listview3.Items,listview3.ItemIndex); end; procedure ShowSetup; begin setgame.TabSheet9.TabVisible :=not istry; setgame.Edit8.Text             :=pass; setgame.Edit9.Text             :=netpath; setgame.AutoUPgameCk.Checked   :=AutoUPgame; setgame.AutoReICOck.Checked    :=AutoRePic; setgame.NeedOutPassCk.Checked  :=NeedOutPass; setgame.ServerIPEdit.Text      :=ServerIp ; setgame.ServerPortEdit.Text    :=inttostr(ServerPort); setgame.MaxCheck.Checked     :=readinifile('设置','窗口最大',true); setgame.AsDesktopCk.Checked  :=readinifile('设置','作为桌面',true); setgame.logoCheck.Checked    :=readinifile('设置','显示logo',true); setgame.pubCheck.Checked     :=readinifile('设置','显示公告',true); setgame.wgCheck.Checked      :=readinifile('设置','显示外挂',true); setgame.RightCheck.Checked   :=readinifile('设置','右边公告',true); setgame.ShowGameTxtCheck.Checked  :=readinifile('设置','显示游戏介绍',true); setgame.ShowPBCheck.Checked       :=readinifile('设置','显示系统公告',true); setgame.ShowNetCheck.Checked      :=readinifile('设置','显示切换网关',true); setgame.ShowNewUPCheck.Checked    :=readinifile('设置','显示最新更新',true); setgame.Memo2.Lines.Text         :=readinifile('设置','系统公告','未设置公告'); setgame.Memo3.Lines.Text         :=readinifile('设置','最新更新','当前无更新'); setgame.RadioGroup1.ItemIndex    :=readinifile('设置','程序外观',1); setgame.colorpanel.Color         :=readinifile('设置','界面颜色',clWindow); setgame.colorpanel.Font.Color    :=readinifile('设置','界面字体颜色',clblack); setgame.NetNameEdit1.Text:=IPListSet1.NetName; setgame.NetEdit1.Text:=IPListSet1.NetIP; setgame.NetSubEdit1.Text:=IPListSet1.NetSub; setgame.aDNSEdit1.Text:=IPListSet1.aDNS; setgame.bDNSEdit1.Text:=IPListSet1.bDNS; setgame.NetNameEdit2.Text:=IPListSet2.NetName; setgame.NetEdit2.Text:=IPListSet2.NetIP; setgame.NetSubEdit2.Text:=IPListSet2.NetSub; setgame.aDNSEdit2.Text:=IPListSet2.aDNS; setgame.bDNSEdit2.Text:=IPListSet2.bDNS; setgame.ToolEdit1.Text      := ToolsInfo.Tools1; setgame.ToolShowCK1.Checked := ToolsInfo.Show1; setgame.ToolEdit2.Text      := ToolsInfo.Tools2; setgame.ToolShowCK2.Checked := ToolsInfo.Show2; setgame.ToolEdit3.Text      := ToolsInfo.Tools3; setgame.ToolShowCK3.Checked := ToolsInfo.Show3; setgame.ToolEdit4.Text      := ToolsInfo.Tools4; setgame.ToolShowCK4.Checked := ToolsInfo.Show4; setgame.ToolEdit5.Text      := ToolsInfo.Tools5; setgame.ToolShowCK5.Checked := ToolsInfo.Show5; setgame.ToolEdit6.Text      := ToolsInfo.Tools6; setgame.ToolShowCK6.Checked := ToolsInfo.Show6; setgame.ToolEdit7.Text      := ToolsInfo.Tools7; setgame.ToolShowCK7.Checked := ToolsInfo.Show7; setgame.AutoUPgameCk.Checked:=AutoUPGame; setgame.BackPicCk.Checked:=UseBackPic; setgame.SJPicCk.Checked:=SjBackPic; setgame.PicCombo1.ItemIndex:=PicIndex; setgame.Editls1.Text:=main.TabSheet1.Caption; setgame.Editls2.Text:=main.TabSheet2.Caption; setgame.Editls3.Text:=main.TabSheet3.Caption; setgame.Editls4.Text:=main.TabSheet4.Caption; setgame.Editls5.Text:=main.TabSheet5.Caption; setgame.Editls6.Text:=main.TabSheet6.Caption; setgame.Editls7.Text:=main.TabSheet7.Caption; setgame.Editls8.Text:=main.TabSheet8.Caption; setgame.Checkls1.Checked:=main.TabSheet1.TabVisible; setgame.Checkls2.Checked:=main.TabSheet2.TabVisible; setgame.Checkls3.Checked:=main.TabSheet3.TabVisible; setgame.Checkls4.Checked:=main.TabSheet4.TabVisible; setgame.Checkls5.Checked:=main.TabSheet5.TabVisible; setgame.Checkls6.Checked:=main.TabSheet6.TabVisible; setgame.Checkls7.Checked:=main.TabSheet7.TabVisible; setgame.Checkls8.Checked:=main.TabSheet8.TabVisible; setgame.FontSizeTrack.Position:=Gamelabel.fontSize; setgame.TabStyleTrack.Position:=Gamelabel.TabStyle; setgame.LabelTrack.Position:=Gamelabel.Height; setgame.TabWidethTrack.Position:=Gamelabel.TabWidth; loadini('分组1-',setgame.ListView1.Items); loadini('分组2-',setgame.ListView2.Items); loadini('分组3-',setgame.ListView3.Items); loadini('分组4-',setgame.ListView4.Items); loadini('分组5-',setgame.ListView5.Items); loadini('分组6-',setgame.ListView6.Items); loadini('分组7-',setgame.ListView7.Items); loadini('分组8-',setgame.ListView8.Items); setgame.Visible:=true; setgame.WindowState:=wsNormal; end; procedure Tmain.setbuttonClick(Sender: TObject); begin if istry then ShowSetup               else  begin                        Passbutton.Tag:=1;                        PassBox.Top:=main.ClientHeight div 3;                        PassBox.Left:=main.ClientWidth div 3;                        PassBox.Show;                        PassEdit.SetFocus;                     end; end; procedure Tmain.Timer1Timer(Sender: TObject); begin    Timer1.Enabled:=false;    GameTextPanel.Visible:=readinifile('设置','显示游戏介绍',true);    SystemTxtPanel.Visible:=readinifile('设置','显示系统公告',true);    NETListBtn.Visible:=readinifile('设置','显示切换网关',true);    NewTxtPanel.Visible:=readinifile('设置','显示最新更新',true); Label1.Caption:='正在启动,请稍侯.....'; StopButton.Enabled:=false; rePanel.Visible:=true; application.ProcessMessages; ProgressBar1.Position:=10; Local_IP:=LocalIP; loadallini; application.ProcessMessages; if UseBackpic then OkPic:=setbackbmp(format('%s%d.jpg',[selfpath,PicIndex])); rePanel.Visible:=false; page1.ActivePage:=TabSheet1; Panel5.Visible:=true; n7.Checked:=main.panel1.Visible; n5.Checked:=main.MainPubPanel.Visible; n6.Checked:= listview9.Visible; isbusy:=false; if setgame.Visible then setgame.WindowState:=wsNormal; if notry and (oem) then begin frmApp.Show; page1.Enabled:=false; end; end; procedure Tmain.FormCreate(Sender: TObject); var userstrings:Tstringlist; Tmps:string; begin begin //正式信息 name1:='飞视游戏菜单 V1.2b'; name2:='飞视游戏菜单 V1.2b'; name3:=' 欢迎您定制或OEM快速、美观、专用的游戏菜单,请联系 QQ 561684 '; //试用信息 sname1:='飞视游戏菜单 V1.2b 免费版'; sname2:='飞视游戏菜单 V1.2b 免费版'; sname3:=' 欢迎您定制或OEM快速、美观、专用的游戏菜单,请联系 QQ 561684 '; end; userstrings:=Tstringlist.Create; IPListSet1:=TIPListSet.Create; IPListSet2:=TIPListSet.Create; Gamelabel:=TGameLabel.Create; ToolsInfo :=TToolsInfo.Create; isbusy:=true; main.Panel5.Visible:=false; selfpath:=ExtractFilePath(Application.Exename); SetCurrentDir(selfpath); try if readinifile('设置','作为桌面',true) then     begin      ShowWindowAsync(Application.Handle, SW_HIDE);      setwindowlong(application.handle,gwl_exstyle,ws_ex_toolwindow);     end; if istry then begin main.Caption:=sname1; application.Title:=sname2; main.StatusBar1.Panels[2].Text:=sname3; end else begin main.Caption:=name1; application.Title:=name2; main.StatusBar1.Panels[2].Text:=name3; end; LOGOtimer.Enabled:=true; finally userstrings.Free; end; prstart(false); end; function CustomSortProc(Item1, Item2: TListItem; ParamSort: integer): integer; stdcall; begin //  Result := -CompareText(Item1.Caption,Item2.Caption); Result := -CompareText(Item1.Caption,Item1.Caption); end; procedure Tmain.FormCanResize(Sender: TObject; var NewWidth,   NewHeight: Integer; var Resize: Boolean); begin ListView1.CustomSort(@CustomSortProc, 0); ListView2.CustomSort(@CustomSortProc, 0); ListView3.CustomSort(@CustomSortProc, 0); ListView4.CustomSort(@CustomSortProc, 0); ListView5.CustomSort(@CustomSortProc, 0); ListView6.CustomSort(@CustomSortProc, 0); ListView7.CustomSort(@CustomSortProc, 0); ListView8.CustomSort(@CustomSortProc, 0); ListView9.CustomSort(@CustomSortProc, 0); if UseBackPic then setbuttonpic(OKPic); end; procedure Tmain.LOGOTimerTimer(Sender: TObject); begin if s1=0 then begin s1:=1; main.logoimage.Picture:=logo1.Picture; end else begin s1:=0; main.logoimage.Picture:=logo2.Picture; end; end; procedure Tmain.N7Click(Sender: TObject); begin main.panel1.Visible:=not main.panel1.Visible; n7.Checked:=main.panel1.Visible; end; procedure Tmain.N5Click(Sender: TObject); begin main.MainPubPanel.Visible:=not main.MainPubPanel.Visible; n5.Checked:=main.MainPubPanel.Visible; end; procedure Tmain.N6Click(Sender: TObject); begin listview9.Visible:=not listview9.Visible; n6.Checked:=listview9.Visible; end; procedure Tmain.N10Click(Sender: TObject); begin if main.MainPubPanel.Align=alLeft then    begin   main.MainPubPanel.Align:=alRight ;   //ToolPUBPanel.Align:=alRight ;   end else   begin   main.MainPubPanel.Align:=alLeft;   //ToolPUBPanel.Align:=alLeft;   end; N10.Checked:=(main.MainPubPanel.Align <> alLeft); end; procedure Tmain.Page1Change(Sender: TObject); begin case page1.ActivePageIndex of 0:  main.StatusBar1.Panels[0].Text:=format('当前 %d 项',[listview1.Items.Count]); 1:  main.StatusBar1.Panels[0].Text:=format('当前 %d 项',[listview2.Items.Count]); 2:  main.StatusBar1.Panels[0].Text:=format('当前 %d 项',[listview3.Items.Count]); 3:  main.StatusBar1.Panels[0].Text:=format('当前 %d 项',[listview4.Items.Count]); 4:  main.StatusBar1.Panels[0].Text:=format('当前 %d 项',[listview5.Items.Count]); 5:  main.StatusBar1.Panels[0].Text:=format('当前 %d 项',[listview6.Items.Count]); 6:  main.StatusBar1.Panels[0].Text:=format('当前 %d 项',[listview7.Items.Count]); 7:  main.StatusBar1.Panels[0].Text:=format('当前 %d 项',[listview8.Items.Count]); 8:  main.StatusBar1.Panels[0].Text:=format('当前 %d 项',[listview9.Items.Count]); end; ClearMemory; end; procedure UPgameset(IsStop:bool); var hbutton1,hparent1:HWND; begin //     hparent:=findwindowex(0,hparent,'#32770',nil);      hparent1:=FindWindow(nil, '拷贝文件');      hbutton1:=findwindowEX(hparent1,0,nil,'停止');   if (hbutton1<>0) then       begin //      main.Edit1.Text:='已经找到程序窗口了'; //      ShowWindow(hparent1, SW_HIDE);         if (not IsStop) then sendmessage(hbutton1,BM_CLICK,0,0);         //   memo1.Lines.Append('找到了') ;       end else     begin         if  (not IsStop) then                begin                main.rePanel.Visible:=false;                exit;                end              else           begin             main.StopButton.Caption:='确定';             main.Label1.Caption:='同步操作已经完成 .';             main.ProgressBar1.Position:=100;           end;       main.REGTimer.Enabled:=false;     end; end; procedure Tmain.REGTimerTimer(Sender: TObject); begin try main.IdUDPServer1.Send(ServerIP,ServerPort,('S_reg'+main.IdUDPServer1.LocalName)); finally end; end; procedure Tmain.StopButtonClick(Sender: TObject); begin if StopButton.Caption='取消' then   begin   StopButton.Enabled:=false;   label1.Caption:='正在取消同步,请稍候.......';   end; if StopButton.Caption='确定' then    begin    rePanel.Visible:=false;    end; end; procedure Tmain.rePanelMouseDown(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); begin with repanel do   begin     ReleaseCapture;     Perform(WM_SYSCOMMAND,$f012,0);   end; end; procedure Tmain.MemoTimerTimer(Sender: TObject); begin if main.Active then    if memo3.Lines.Count>10 then     begin      memo3.Lines.Append(memo3.Lines.Strings[0]);      memo3.Lines.Delete(0);     end; end; procedure SetNet(NetSet:TIPListSet); var line1,line2,line3:string; begin if application.MessageBox(Pchar(format('要切换到 %s 线路吗 ? ',[NetSet.NetName])),'系统信息',MB_YESNO+MB_Iconquestion)=IDyes then if (NetSet.NetName <> '') and (NetSet.NetIP <> '') and (NetSet.NetSub <> '') and (NetSet.aDNS <> '') then   begin     line1:= format('netsh interface ip set address name="本地连接" source=static addr=%s mask=%s gateway=%s gwmetric=1',     [Local_IP,NetSet.NetSub,NetSet.NetIP]);     line2:=format('netsh interface ip set dns name="本地连接" source=static addr=%s',[NetSet.aDNS]);     line3:=format('netsh interface ip add dns name="本地连接" addr=%s index=2',[NetSet.bDNS]);     if isfree then application.Terminate;     ExeWait(line1,SW_HIDE);     ExeWait(line2,SW_HIDE);     ExeWait(line3,SW_HIDE);     application.MessageBox(Pchar(NetSet.NetName+' 线路切换成功 !'),' 提示 ',mb_ok+MB_ICONINFORMATION);     end else application.MessageBox('未设置网络参数 !',' 提示 ',mb_ok+MB_ICONINFORMATION);     end; procedure Tmain.N8Click(Sender: TObject); begin randomize; UseBackPic:=true; setbackbmp(format('%s%d.jpg',[selfpath,random(10)])); end; procedure Tmain.Action2Execute(Sender: TObject); begin if oem then frmApp.Show; end; function StreamToStr(AData: TStream;var StrId:string):string; var strstream:TStringStream; begin   strstream:=TStringStream.Create('');   try   AData.Position:=0;   strstream.CopyFrom(AData,AData.Size);   StrId:= copy(strstream.DataString,0,5);   result:=copy(strstream.DataString,6,AData.Size);   finally   strstream.Free;   end; end; procedure addgameTop(str1,str2,str3,str4,str5,str6:string;Ietmx:TListItems); var   listitem:Tlistitem; begin try listitem:= Ietmx.Add; listitem.Caption:=str1; listitem.SubItems.Add(str2); listitem.SubItems.Add(str3); listitem.SubItems.Add(str4); listitem.SubItems.Add(str5); listitem.SubItems.Add(str6); listitem.ImageIndex:=19; finally end; end; procedure StrToGameTop(i:integer; strx,strs:string;list:TListItems); var n1:integer; str1,str2,str3,str4,str5:string; begin try strs:=copy(strs,1,length(strs)); n1:=pos(strx,strs); str1:=copy(strs,1,n1-1); strs:=copy(strs,n1+2,length(strs)); n1:=pos(strx,strs); str2:=copy(strs,0,n1-1); strs:=copy(strs,n1+2,length(strs)); n1:=pos(strx,strs); str3:=copy(strs,0,n1-1); strs:=copy(strs,n1+2,length(strs)); n1:=pos(strx,strs); str4:=copy(strs,0,n1-1); strs:=copy(strs,n1+2,length(strs)); n1:=pos(strx,strs); if n1 > 0 then  str5:=copy(strs,0,n1) else str5:=strs; strs:=copy(strs,n1+2,length(strs));                                        //timetostr(now) addgameTop(inttostr(i),str5,str1,str2,str3,str4,main.GameTopListView.Items); finally end; end; procedure StrsToGameTop(Stream:TStream;Ietmx:TListItems); var   strs:Tstringlist;          i:integer; begin   Strs:=Tstringlist.Create; try Stream.Position:=5; strs.LoadFromStream(Stream); main.GameTopListView.Items.Clear; for i:=0 to strs.Count-1 do begin StrToGameTop(i+1,'<>',strs[i],main.GameTopListView.Items); end; finally strs.Free; end; end; procedure Tmain.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;   ABinding: TIdSocketHandle);   var  StrId,Str:string; begin   if AData.Size < 6 then exit;   Str:=StreamToStr(AData,StrId);   if Strid = 'S_reg' then    begin     memo4.Lines.Append(format('ID %s , 内容 %s',[StrId,Str]));     REGTimer.Enabled:=false;    end;   if Strid = 'S_gck' then    begin      memo4.Lines.Append(format('ID %s , 内容 %s',[StrId,Str]));      StrsToGameTop(AData,main.GameTopListView.Items);    end; end; procedure Tmain.Button1Click(Sender: TObject); var i:integer; begin for i:= 1 to 5 do                              //IdUDPServer1.LocalName IdUDPServer1.Send(ServerIP,ServerPort,('S_reg'+format('Game %d',[i]))); end; procedure Tmain.PassButtonClick(Sender: TObject); begin if not not not(PassEdit.Text <> pass) then   begin     case  Passbutton.Tag of     1:   ShowSetup;     2:   exectools(selfpath+'tools');     3:   application.Terminate;     end; end; PassBox.Visible:=false; PassEdit.Clear; end; procedure Tmain.Button3Click(Sender: TObject); begin PassBox.Visible:=false; PassEdit.Clear; end; procedure Tmain.Panel4MouseDown(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); begin with PassBox do   begin     ReleaseCapture;     Perform(WM_SYSCOMMAND,$f012,0);   end; end; procedure Tmain.Button4Click(Sender: TObject); var i:integer; begin for i:= 6 to 11 do                              //IdUDPServer1.LocalName IdUDPServer1.Send(ServerIP,ServerPort,('S_reg'+format('Game %d',[i]))); end; procedure Tmain.Panel3MouseDown(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); begin with panel3 do   begin     ReleaseCapture;     Perform(WM_SYSCOMMAND,$f012,0);   end; end; procedure FindGame(Itemsx:Tlistitems); var i:integer; begin begin for i:=0 to Itemsx.Count-1 do if pos(UpperCase(main.SeachEdit.Text),UpperCase(Itemsx.Item[i].Caption)) <> 0 then addgamelist( Itemsx.Item[i].Caption, Itemsx.Item[i].SubItems[0], Itemsx.Item[i].SubItems[1], Itemsx.Item[i].SubItems[2], Itemsx.Item[i].SubItems[3], Itemsx.Item[i].SubItems[4], Itemsx.Item[i].SubItems[5], main.ListView9.items); end; end; procedure Tmain.ViewBtnClick(Sender: TObject); begin if SeachEdit.Text = '' then exit; main.SeathTab.TabVisible:=true; Listview9.Items.Clear; if TabSheet1.TabVisible then FindGame(Listview1.Items); if TabSheet2.TabVisible then FindGame(Listview2.Items); if TabSheet3.TabVisible then FindGame(Listview3.Items); if TabSheet4.TabVisible then FindGame(Listview4.Items); if TabSheet5.TabVisible then FindGame(Listview5.Items); if TabSheet6.TabVisible then FindGame(Listview6.Items); if TabSheet7.TabVisible then FindGame(Listview7.Items); if TabSheet8.TabVisible then FindGame(Listview8.Items); Page1.ActivePage:=SeathTab; end; procedure Tmain.RzPanel5MouseEnter(Sender: TObject); begin MemoTimer.Enabled:=false; end; procedure Tmain.RzPanel5MouseLeave(Sender: TObject); begin MemoTimer.Enabled:=true; end; procedure Tmain.RzToolButton1Click(Sender: TObject); begin if MainPubPanel.Visible and (page2.ActivePageIndex=0) then begin MainPubPanel.Visible:=false; exit; end; MainPubPanel.Visible:=true; page2.ActivePageIndex:=0; end; procedure Tmain.N_net1Click(Sender: TObject); begin SetNet(IPListSet1); end; procedure Tmain.N_net2Click(Sender: TObject); begin SetNet(IPListSet2); end; function CustomSortProc2(Item1, Item2: TListItem; ColumnIndex: integer): integer; stdcall; var i:integer; begin //if VSort then i:=1 else i:=-1; i:=1; try if ColumnIndex = 0 then Result := -(StrToInt(Item1.Caption) - StrToInt(Item2.Caption)) * i else Result := -(StrToInt(Item1.SubItems[ColumnIndex-1]) - StrToInt(Item2.SubItems[ColumnIndex-1])) * i; finally; end; end; procedure ReListGameTop(ColumnIndex:integer); begin main.GameTopListView.CustomSort(@CustomSortProc2,ColumnIndex); case ColumnIndex of 2:   main.GameTopLabel.Caption:='游戏排行榜 - 总排行'; 3:   main.GameTopLabel.Caption:='游戏排行榜 - 月排行'; 4:   main.GameTopLabel.Caption:='游戏排行榜 - 周排行'; 5:   main.GameTopLabel.Caption:='游戏排行榜 - 日排行'; end; main.GameTopListView.Columns.Items[2].Width:=0; main.GameTopListView.Columns.Items[3].Width:=0; main.GameTopListView.Columns.Items[4].Width:=0; main.GameTopListView.Columns.Items[5].Width:=0; main.GameTopListView.Columns.Items[ColumnIndex].Width:=52; end; procedure Tmain.NoteBtnClick(Sender: TObject); begin if MainPubPanel.Visible and (page2.ActivePageIndex=2) then begin MainPubPanel.Visible:=false; exit; end; MainPubPanel.Visible:=true; page2.ActivePageIndex:=2; end; procedure Tmain.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin    if NeedOutPass then     begin     CanClose:=false;     PassBox.Top:=main.ClientHeight div 3;     PassBox.Left:=main.ClientWidth div 3;     PassBox.Show;     PassEdit.SetFocus;     Passbutton.Tag:=3;     end; end; procedure Tmain.ClenToolButtonClick(Sender: TObject); begin LYEdit.Text:=''; LYMemo.Lines.Clear; end; procedure Tmain.RzToolButton3Click(Sender: TObject); begin if (LYEdit.Text = '请输入姓名') or (LyMemo.Lines[0] = '请输入留言内容')     or (LYEdit.Text = '') or (LyMemo.Lines[0] = '') then application.MessageBox('请输入您的 "姓名" 和 "留言内容" ,谢谢您的支持 .',' 提示 ',mb_ok+MB_ICONINFORMATION) else if application.MessageBox('您要提交这条留言吗 ? ','系统信息',MB_YESNO+MB_Iconquestion)=IDyes then begin       IdUDPServer1.Send(ServerIP,ServerPort,('S_lys'+       format('[%s] %s 留言说: %s',[DateTimeToStr(now),LYEdit.Text,LyMemo.Lines.Text])));       application.MessageBox('感谢您的留言,我们会尽快处理您的意见和建议 。 ',' 提示 ',mb_ok+MB_ICONINFORMATION);       ClenToolButton.Click;      end; end; procedure Tmain.N22Click(Sender: TObject); begin    Passbutton.Tag:=2;    PassBox.Top:=main.ClientHeight div 3;    PassBox.Left:=main.ClientWidth div 3;    PassBox.Show;    PassEdit.SetFocus; end; procedure Tmain.VolumeBtnClick(Sender: TObject); begin exectools(ToolsInfo.Tools5); end; procedure Tmain.PassEditKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then PassButton.Click; end; procedure Tmain.Page2Change(Sender: TObject); begin if (Page2.ActivePage = GameTopTabSheet) and (GameTopListView.Items.Count = 0)    then RefreshBtn.Click; end; procedure Tmain.LYEditEnter(Sender: TObject); begin if (LYEdit.Text = '请输入姓名') then    begin     LYEdit.Text:='';     LYEdit.Font.Color:=clBlack;    end; end; procedure Tmain.LYEditExit(Sender: TObject); begin if (LYEdit.Text = '') then   begin    LYEdit.Text:='请输入姓名';    LYEdit.Font.Color:=clSilver;   end; end; procedure Tmain.LYMemoEnter(Sender: TObject); begin if (LYMemo.Lines[0] = '请输入留言内容') then    begin     LYMemo.Text:='';     LYMemo.Font.Color:=clBlack;    end; end; procedure Tmain.LYMemoExit(Sender: TObject); begin if (LYMemo.Lines[0] = '') then   begin    LYMemo.lines.Text:='请输入留言内容';    LYMemo.Font.Color:=clSilver;   end; end; end. function  ckokpath(path:string):string; procedure setcolor(colorx,colorx1:Tcolor); procedure saveseting(num:integer;itemsx:TListItems); implementation uses gamemenu,UseIniFile; {$R *.dfm} procedure foundwg2(listviewx,wglistview,swglistview:Tlistview); var i:integer; ls:string; begin if listviewx.ItemIndex > -1 then begin //swglistview.Items.Clear; ls:=listviewx.Items.Item[listviewx.ItemIndex].SubItems[2]; for i:=0 to wglistview.Items.Count-1 do if pos((','+inttostr(i)),ls) <> 0 then swglistview.Items.Item[i].Checked:=true else swglistview.Items.Item[i].Checked:=false; end; end; procedure listtoedit(listviewx:Tlistview); var i:integer; begin if listviewx.ItemIndex >-1 then begin i:=listviewx.ItemIndex; setgame.Edit1.Text:=listviewx.Items.Item[i].Caption; setgame.Edit2.Text:=listviewx.Items.Item[i].SubItems[0]; setgame.Edit3.Text:=listviewx.Items.Item[i].SubItems[1]; setgame.Edit4.Text:=listviewx.Items.Item[i].SubItems[3]; setgame.Edit5.Text:=listviewx.Items.Item[i].SubItems[5]; setgame.memo1.Text:=setgame.edit4.Text; setgame.wgListView.Items.Assign(setgame.ListView8.Items); foundwg2(listviewx,setgame.ListView8,setgame.wgListView); end; end; function cklistviewtostr(listviewx:Tlistview):string; var i:integer; ls:string; begin ls:=''; for i:=0 to listviewx.Items.Count-1 do begin if listviewx.Items[i].Checked then ls:=ls+','+inttostr(i); end; result:=ls+','; end; procedure edittolist(listviewx:Tlistview); var I:integer; begin if listviewx.ItemIndex >-1 then begin i:=listviewx.ItemIndex; listviewx.Items.Item[i].Caption:=setgame.Edit1.Text; listviewx.Items.Item[i].SubItems[0]:=setgame.Edit2.Text; listviewx.Items.Item[i].SubItems[1]:=setgame.Edit3.Text; listviewx.Items.Item[i].SubItems[2]:=cklistviewtostr(setgame.wgListView); listviewx.Items.Item[i].SubItems[3]:=setgame.Edit4.Text; end; end; procedure MoveItemUp(ListViewx:TListView); var i:integer; ListItemx:TlistItem; begin i:=ListViewx.ItemIndex ; if  (i <> -1) and (i > 0) then   begin    Listitemx:=ListViewx.Items.Insert(i-1);    Listitemx.Caption:=ListViewx.Items.Item[i+1].Caption;    Listitemx.SubItems:=ListViewx.Items.Item[i+1].SubItems;    ListItemx.ImageIndex:=ListViewx.Items.Item[I+1].ImageIndex;    ListViewx.Items.Delete(i+1);    ListViewx.ItemIndex:=I-1;    ListViewx.Items[i-1].MakeVisible(true);   end; end; procedure MoveItemDown(ListViewx:TListView); var i:integer; ListItemx:TlistItem; begin i:=ListViewx.ItemIndex ; if  (i <> -1) and (i < ListViewx.Items.Count-1) then   begin    Listitemx:=ListViewx.Items.Insert(i+2);    Listitemx.Caption:=ListViewx.Items.Item[i].Caption;    Listitemx.SubItems:=ListViewx.Items.Item[i].SubItems;    ListItemx.ImageIndex:=ListViewx.Items.Item[i].ImageIndex;    ListViewx.Items.Delete(i);    ListViewx.ItemIndex:=I+1;    ListViewx.Items[i+1].MakeVisible(true);   end; end; procedure Tsetgame.Button6Click(Sender: TObject); begin case setnum of 0:  MoveItemUp(ListView1); 1:  MoveItemUp(ListView2); 2:  MoveItemUp(ListView3); 3:  MoveItemUp(ListView4); 4:  MoveItemUp(ListView5); 5:  MoveItemUp(ListView6); 6:  MoveItemUp(ListView7); 7:  MoveItemUp(ListView8); end; end; procedure Tsetgame.Button5Click(Sender: TObject); begin case setnum of 0:  MoveItemDown(ListView1); 1:  MoveItemDown(ListView2); 2:  MoveItemDown(ListView3); 3:  MoveItemDown(ListView4); 4:  MoveItemDown(ListView5); 5:  MoveItemDown(ListView6); 6:  MoveItemDown(ListView7); 7:  MoveItemDown(ListView8); end; end; procedure Tsetgame.PicCombo1Select(Sender: TObject); begin OkPic:=setbackbmp(format('%s%d.jpg',[selfpath,PicCombo1.ItemIndex])); end; procedure Tsetgame.wgListViewExit(Sender: TObject); begin SetGameInfo; end; procedure Tsetgame.LS_ColorLabelClick(Sender: TObject); begin if ColorDialog1.Execute then begin colorpanel.Color:=ColorDialog1.Color; setcolor(colorpanel.Color,colorpanel.Font.Color); end; end; procedure Tsetgame.Label7Click(Sender: TObject); begin if ColorDialog1.Execute then begin GameLabel.Color:=ColorDialog1.Color; SetPage1(GameLabel); end; end; procedure Tsetgame.Label40Click(Sender: TObject); begin if ColorDialog1.Execute then begin GameLabel.TextColor:=ColorDialog1.Color; SetPage1(GameLabel); end; end; procedure Tsetgame.LabelTrackChange(Sender: TObject); begin GameLabel.Height:=LabelTrack.Position; SetPage1(GameLabel); end; procedure Tsetgame.TabStyleTrackChange(Sender: TObject); begin GameLabel.TabStyle:=TabStyleTrack.Position; SetPage1(GameLabel); end; procedure Tsetgame.FontSizeTrackChange(Sender: TObject); begin GameLabel.fontSize:=FontSizeTrack.Position; SetPage1(GameLabel); end; procedure Tsetgame.TabWidethTrackChange(Sender: TObject); begin GameLabel.TabWidth:=TabWidethTrack.Position; SetPage1(GameLabel); end; procedure Tsetgame.Button7Click(Sender: TObject); begin setgame.WindowState:=wsMinimized; application.ProcessMessages; SetGameInfo; saveini; setgame.WindowState:=wsNormal; end; procedure Tsetgame.LS_FontColorLabelClick(Sender: TObject); begin if ColorDialog1.Execute then begin setgame.colorpanel.Font.Color:=ColorDialog1.Color; setcolor(colorpanel.Color,colorpanel.Font.Color); end; end; procedure Tsetgame.AsDesktopCkMouseUp(Sender: TObject;   Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin application.MessageBox('重新启动程序后此设置才生效  !',' 提示 ',mb_ok+MB_ICONINFORMATION); end; procedure Tsetgame.Checkls1MouseUp(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); begin Checkls1.Checked:=true; application.MessageBox('第一个分类不能隐藏,您可以修改为其它名称,例如 "最新推荐"  !',' 提示 ',mb_ok+MB_ICONINFORMATION); end; procedure Tsetgame.Button10Click(Sender: TObject); begin button11.Click; setgame.Close; end; procedure Tsetgame.DeTool1Click(Sender: TObject); begin Tooledit1.text:=format('%stools/Grachics.lnk',[selfpath]);end; procedure Tsetgame.DeTool2Click(Sender: TObject); begin Tooledit2.text:=format('%stools/IME.exe',[selfpath]); end; procedure Tsetgame.DeTool3Click(Sender: TObject); begin Tooledit3.text:=format('%stools/key.lnk',[selfpath]); end; procedure Tsetgame.DeTool4Click(Sender: TObject); begin Tooledit4.text:=format('%stools/mouse.lnk',[selfpath]); end; procedure Tsetgame.DeTool5Click(Sender: TObject); begin Tooledit5.text:='C:/WINDOWS/system32/sndvol32.exe'; end; procedure RunTool(Path:string); begin exectools(path); end; procedure Tsetgame.ToolTest1Click(Sender: TObject); begin Runtool(ToolEdit1.Text); end; procedure Tsetgame.ToolTest2Click(Sender: TObject); begin Runtool(ToolEdit2.Text); end; procedure Tsetgame.Button12Click(Sender: TObject); begin winexec('rundll32.exe shell32.dll,Control_RunDLL access.cpl,,2',9); end; procedure Tsetgame.ToolTest5Click(Sender: TObject); begin Runtool(ToolEdit5.Text); end; procedure Tsetgame.ToolTest4Click(Sender: TObject); begin Runtool(ToolEdit4.Text); end; procedure Tsetgame.ToolTest3Click(Sender: TObject); begin Runtool(ToolEdit3.Text); end; end.  

    最新回复(0)