⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.pas

📁 这是一个非常好的教师和学生沟通用的电子教室!
💻 PAS
📖 第 1 页 / 共 5 页
字号:
      Gmovief.Left := 0;
      Gmovief.Height := screen.Height;
      Gmovief.Width := Screen.Width;
//      Gmovief.OnCloseQuery := FormCloseQuery;
      Gmovief.Show;
      exit;
    end;

    if copy(s_command, 1, 8) = '打开影院' then
    begin
      s_path := copy(s_command, 9, length(s_command) - 8);
      yingyuan_path := s_path;
      w_yingyuan := '打开影院';
      exit;
    end;

    if copy(s_command, 1, 8) = '打开课件' then
    begin
      s_path := copy(s_command, 9, length(s_command) - 8);
      ShellExecute(handle, 'open', pchar(s_path), nil, nil, SW_ShowNormal);
      exit;
    end;

    if copy(s_command, 1, 8) = '影院起点' then
    begin
      w_yingyuan := '影院起点';
      yingyuan_start := strtoint(copy(s_command, 9, length(s_command) - 8));
      exit;
    end;

    if copy(s_command, 1, 8) = '影院时间' then
    begin
      w_yingyuan := '影院时间';
      yingyuan_start := strtoint(copy(s_command, 9, length(s_command) - 8));
      exit;
    end;

    if copy(s_command, 1, 8) = '播放影院' then
    begin
      w_yingyuan := '播放影院';
      Play_count := strtoint(copy(s_command, 9, length(s_command) - 8));
      exit;
    end;

    if copy(s_command, 1, 8) = '暂停影院' then
    begin
      w_yingyuan := '暂停影院';
     // Gmovief.ActiveMovie1.Pause;
      exit;
    end;

    if copy(s_command, 1, 8) = '继续影院' then
    begin
      w_yingyuan := '继续影院';
    //  Gmovief.Panel1.Visible:=false;
    //  Gmovief.ActiveMovie1.Run;
      exit;
    end;

    if copy(s_command, 1, 8) = '停止影院' then
    begin
      w_yingyuan := '停止影院';
      exit;
    end;

    if copy(s_command, 1, 8) = '退出影院' then
    begin
      w_yingyuan := '退出影院';
       //解锁系统
      showcursor(true);
         //解开鼠标
      rtScreen := Rect(0, 0, Screen.Width, Screen.Height);
      ClipCursor(@rtScreen);
       //开放任务条
      strpcopy(@wndClass[0], 'Shell_TrayWnd');
      WndHandle := FindWindow(@WndClass[0], nil);
      ShowWindow(wndHandle, sw_restore);
       //开放系统键
      SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, @temp, 0);
      exit;
    end;

    if copy(s_command, 1, 8) = '语音对讲' then
    begin
      guangbo_state := '语音对讲';

      SetForegroundWindow(Form1.Handle); //设置到最前面

      if acmMetrics(nil, ACM_METRIC_MAX_SIZE_FORMAT, FMaxFmtSize) <> 0 then begin
        showmessage('Error getting the max compression format size.');
        Exit;
      end;

      GetMem(Format, FMaxFmtSize);
      if Format = nil then begin
        showmessage('Error allocating local memory for WaveFormatEx structure.');
        Exit;
      end;

    // initialize the format to standard PCM...
      FillChar(Format^, FMaxFmtSize, 0); //设置接受频率
      Format.wFormatTag := WAVE_FORMAT_PCM;
      Format.nChannels := 1;
      Format.nSamplesPerSec := 11025;
      Format.nAvgBytesPerSec := 11025;
      Format.nBlockAlign := 1;
      Format.wBitsPerSample := 8;
      Format.cbSize := 0;

      SoundOut1.Open(format);
      SoundIn1.Open(format); //打开输入
      voice_wsh := Tmemorystream.Create;
      voice_wsh.Position := 0;
      sendwav := Tmemorystream.Create;
      sendwav.Position := 0;

      SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, @temp, 0);

      Rvoicesocket.Close;
      RVoiceSocket.Proto := 'udp';
      RVoiceSocket.Addr := '0.0.0.0';
      RVoiceSocket.MultiCast := true;
      RVoiceSocket.ReuseAddr := true;
      RVoiceSocket.Port := '666';
      RVoiceSocket.MultiCastAddrStr := '225.1.2.6';
      RVoiceSocket.Listen;

      SVoiceSocket.Close;
      SVoiceSocket.MultiCast := true;
      SVoiceSocket.Proto := 'udp';
      SVoiceSocket.Addr := '225.1.2.7';
      SVoiceSocket.Port := '777';
      SVoiceSocket.Connect;

      Guangboing := true;
      soundj.show;
      soundj.flatpanel1.caption:='语音对讲已被打开...';
      exit;
    end;

    if copy(s_command, 1, 8) = '停止对讲' then
    begin
      Guangboing := false;
      SVoicesocket.Close;
      guangbo_state := '';
       //解锁系统
      showcursor(true);
         //解开鼠标
      rtScreen := Rect(0, 0, Screen.Width, Screen.Height);
      ClipCursor(@rtScreen);

      SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, @temp, 0);
      SoundOut1.Close; //关闭语音
      Soundin1.Close;
      voice_wsh.Clear;
      voice_wsh.Free;
      sendwav.Clear;
      sendwav.Free;
      //GuangBof.Hide; //关闭窗口
      soundj.Close ;
      exit;
    end;

    if copy(s_command, 1, 8) = '语音广播' then
    begin
      SetForegroundWindow(Form1.Handle); //设置到最前面

      if acmMetrics(nil, ACM_METRIC_MAX_SIZE_FORMAT, FMaxFmtSize) <> 0 then begin
        showmessage('Error getting the max compression format size.');
        Exit;
      end;

      GetMem(Format, FMaxFmtSize);
      if Format = nil then begin
        showmessage('Error allocating local memory for WaveFormatEx structure.');
        Exit;
      end;

    // initialize the format to standard PCM...
      FillChar(Format^, FMaxFmtSize, 0); //设置接受频率
      Format.wFormatTag := WAVE_FORMAT_PCM;
      Format.nChannels := 2;
      Format.nSamplesPerSec := 44100;
      Format.nAvgBytesPerSec := 176400;
      Format.nBlockAlign := 4;
      Format.wBitsPerSample := 16;
      Format.cbSize := 0;

      SoundOut1.Open(format);
      voice_wsh := Tmemorystream.Create;
      voice_wsh.Position := 0;

      SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, @temp, 0);

      Rvoicesocket.Close;
      RVoiceSocket.Proto := 'udp';
      RVoiceSocket.Addr := '0.0.0.0';
      RVoiceSocket.MultiCast := true;
      RVoiceSocket.ReuseAddr := true;
      RVoiceSocket.Port := '666';
      RVoiceSocket.MultiCastAddrStr := '225.1.2.6';
      RVoiceSocket.Listen;

      Guangboing := true;
      soundj.show;
      soundj.flatpanel1.caption:='接收语音广播...';
      guangbo_state := '语音广播';
      exit;
    end;

    if copy(s_command, 1, 8) = '停止语音' then
    begin
      Guangboing := false;
      RVOicesocket.Close; //关闭通讯
      guangbo_state := '';
       //解锁系统
      showcursor(true);
         //解开鼠标
      rtScreen := Rect(0, 0, Screen.Width, Screen.Height);
      ClipCursor(@rtScreen);

      SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, @temp, 0);
      SoundOut1.Close; //关闭语音
      voice_wsh.Clear;
      voice_wsh.Free;
      //GuangBof.Hide; //关闭窗口
      soundj.close;
      LMDTrayIcon1.Active:=true;
      exit;
    end;

    if copy(s_command, 1, 8) = '屏幕广播' then
    begin
      if guangbo_state = '屏幕广播' then exit;

      guangbo_state := '屏幕广播';
      allsize := 0;
      quan_screen := true;
      draw_ok := true;
      mouse_event(MOUSEEVENTF_LEFTDOWN, 1, 1, 0, 0); //去掉屏幕保护
      mouse_event(MOUSEEVENTF_LEFTUP, 1, 1, 0, 0);
      sleep(5);

      SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, @temp, 0);
       //初试化流
      bmpstream := Tmemorystream.Create;
      bmpstream.Clear;
      drawstream := TmemoryStream.Create;
      drawstream.Clear;
      priscreen := Tbitmap.Create;
      priscreen.Width := screen.Width;
      priscreen.Height := screen.Height;
      priscreen.Canvas.brush.Color:=clBlack;
      priscreen.Canvas.FillRect(rect(0, 0, screen.width, screen.height));

      Guangboing := true; //打开窗口
      guangbof.Left := 0;
      guangbof.Top := 0;
      guangbof.Width := screen.Width;
      guangbof.Height := screen.height;
      guangbof.Label1.Caption := '接收屏幕广播...';
      Guangbof.Show;
      exit;
    end;

    if copy(s_command, 1, 8) = '开始屏幕' then
    begin
      guangbof.Label1.Visible := false;
      setcursorpos(screen.Width, screen.Height);
        // guangbof.DXDraw1.Visible:=true;

      s_path := '';
      s_path := copy(s_command, 9, length(s_command) - 8);
      if pos('nomouse', s_path) > 0 then //用系统的鼠标
      begin
        showcursor(true);
         //解开鼠标
        rtScreen := Rect(0, 0, Screen.Width, Screen.Height);
        ClipCursor(@rtScreen);
      end;

      havesendvoice := false;
      if pos('sendvoice', s_path) > 0 then //如果有传诵语音
      begin
        havesendvoice := true;
        if acmMetrics(nil, ACM_METRIC_MAX_SIZE_FORMAT, FMaxFmtSize) <> 0 then begin
          showmessage('Error getting the max compression format size.');
          Exit;
        end;

        GetMem(Format, FMaxFmtSize);
        if Format = nil then begin
          showmessage('Error allocating local memory for WaveFormatEx structure.');
          Exit;
        end;

    // initialize the format to standard PCM...
        FillChar(Format^, FMaxFmtSize, 0); //设置接受频率
        Format.wFormatTag := WAVE_FORMAT_PCM;
        Format.nChannels := 1;
        Format.nSamplesPerSec := 11025;
        Format.nAvgBytesPerSec := 11025;
        Format.nBlockAlign := 1;
        Format.wBitsPerSample := 8;
        Format.cbSize := 0;

        SoundOut1.Close;
        SoundOut1.Open(format);
        voice_wsh := Tmemorystream.Create;
        voice_wsh.Position := 0;

         if RVoiceSocket.State<>wsclosed then Rvoicesocket.Close;
        RVoiceSocket.Proto := 'udp';
        RVoiceSocket.Addr := '0.0.0.0';
        RVoiceSocket.MultiCast := true;
        RVoiceSocket.ReuseAddr := true;
        RVoiceSocket.Port := '666';
        RVoiceSocket.MultiCastAddrStr := '225.1.2.6';
        RVoiceSocket.Listen;
      end;

      if pos('zip', s_path) > 0 then
        guangbof.DXTimer1.Enabled := true;

      if pos('lzrw', s_path) > 0 then
        guangbof.DXTimer2.Enabled := true;

      if pos('tcp', s_path) > 0 then begin //如果TCP协议
        xieyi := 0;
         if wSocket.State<>wsclosed then wsocket.Close;
        wSocket.Proto := 'udp';
        wSocket.Addr := '0.0.0.0';
        wSocket.MultiCast := true;
        wSocket.ReuseAddr := true;
        wSocket.Port := '12345'; // or whatever
        wSocket.MultiCastAddrStr := '225.1.2.3'; // or whatever
        wSocket.Listen();


        if wSockethook.State<>wsclosed then WSocketHook.Close;
        WSockethook.Proto := 'udp';
        WSockethook.Addr := '0.0.0.0';
        WSockethook.MultiCast := true;
        WSocketHook.ReuseAddr := true;
        WSockethook.Port := '999';
        WSocketHook.MultiCastAddrStr := '225.1.2.4';
        WSockethook.Listen;

        if wSocketsize.State<>wsclosed then WSocketsize.Close;
        WSocketsize.Proto := 'udp';
        WSocketsize.Addr := '0.0.0.0';
        WSocketsize.MultiCast := true;
        WSocketsize.ReuseAddr := true;
        WSocketsize.Port := '518';
        WSocketsize.MultiCastAddrStr := '225.1.2.5';
        WSocketsize.Listen;
      end;

      if pos('ipx', s_path) > 0 then //如果IPX协议
      begin
        xieyi := 1;
        try
          ipx1.Close;
          ipx2.Close;
          IPX1.Open;
          ipx2.open;
        except
          showmessage('您没有添加IPX/SPX网络协议!');
          exit;
        end;
      end;
      exit;
    end;


    if copy(s_command, 1, 8) = '停止广播' then
    begin
      hua_ok := false;
      draw_ok := true;
      Guangboing := false;
      quan_screen := false;
      guangbof.DXTimer1.Enabled := false;
      guangbof.DXTimer2.Enabled := false;
   //    guangbof.Image1.Picture.Assign(nil);
      guangbof.Label1.Visible := true;
      guangbo_state := '';
       //解锁系统
      showcursor(true);
         //解开鼠标
      rtScreen := Rect(0, 0, Screen.Width, Screen.Height);
      ClipCursor(@rtScreen);

      SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, @temp, 0);
      if xieyi = 1 then
      begin
        IPX1.Close; //关闭通讯
        ipx2.close;
      end
      else
      begin
        wsocket.close;
        wsocketsize.close;
        Wsockethook.Close;
      end;
      Guangboing := false;
      GuangBof.Hide; //关闭窗口
      bmpstream.Clear;
      bmpstream.Free;
      drawstream.Clear;
      drawstream.Free;
      priscreen.FreeImage; //清除流
      priscreen.Free;
      priscreen := nil;
      if havesendvoice then //如果有传输语音
      begin
        RVOicesocket.Close; //关闭通讯
        SoundOut1.Close; //关闭语音
        voice_wsh.Clear;
        voice_wsh.Free;
      end;
      LMDTrayIcon1.Active := true;
      exit;
    end;

    if copy(s_command, 1, 8) = '关闭会议' then
    begin
      showcursor(true);
         //解开鼠标
      rtScreen := Rect(0, 0, Screen.Width, Screen.Height);
      ClipCursor(@rtScreen);

      SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, @temp, 0);
      BiancoLock1.Text := 'wshlock';
      BiancoLock1.UNEXECUTE;
      BiancoLock1.Text := '';

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -