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

📄 untcomm.pas

📁 phonectrl是一款利用手机遥控电脑的软件
💻 PAS
📖 第 1 页 / 共 5 页
字号:
        if KeyDown then
        begin
          mouse_event(MOUSEEVENTF_MOVE, -2*iMouseMoveSpeed, 0, 0, 0);
          Sleep(500);
          FMain.tMouse.Enabled := True;
        end else
          FMain.tMouse.Enabled := False;
      end;
    1: //UP
      begin
        if KeyDown then
        begin
          mouse_event(MOUSEEVENTF_MOVE, 0, -2*iMouseMoveSpeed, 0, 0);
          Sleep(500);
          FMain.tMouse.Enabled := True;
        end else
          FMain.tMouse.Enabled := False;
      end;
    2: //RIGHT
      begin
        if KeyDown then
        begin
          mouse_event(MOUSEEVENTF_MOVE, 2*iMouseMoveSpeed, 0, 0, 0);
          Sleep(500);
          FMain.tMouse.Enabled := True;
        end else
          FMain.tMouse.Enabled := False;
      end;
    3: //DOWN
      begin
        if KeyDown then
        begin
          mouse_event(MOUSEEVENTF_MOVE, 0, 2*iMouseMoveSpeed, 0, 0);
          Sleep(500);
          FMain.tMouse.Enabled := True;
        end else
          FMain.tMouse.Enabled := False;
      end;
    4:  //LBUTTON
      begin
        if KeyDown then
          mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
        else
          mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
      end;
    5: //MBUTTON
      begin
        if KeyDown then
          mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0)
        else
          mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0);
      end;
    6: //RBUTTON
      begin
        if KeyDown then
          mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
        else
          mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
      end;
  end;
end;

{-------------------------------------------------------------------------------
  过程名:    SendKeyBoardEvent
  作者:      小冬[kendling]
  邮件:      kendling@sina.com
  主页:      http://www.MyvNet.com
  日期:      2005.02.25
  参数:      const strKey: string; const KeyDown: Boolean
  返回值:    无
  说明:      发送按键事件
-------------------------------------------------------------------------------}
procedure SendKeyBoardEvent(const strKey: string; const KeyDown: Boolean);
var
  vkCtrl,
    vkShift,
    vkAlt,
    vkWin:    Boolean;
  vkKey:      string;
  i:          Integer;
begin
  vkCtrl  := False;
  vkShift := False;
  vkAlt   := False;
  vkWin   := False;
  if KeyDown then
  begin
    //帮助
    if UpperCase(strKey) = 'HELP' then
    begin
      ShowHelp;
      Exit;
    end;
    //退出
    if UpperCase(strKey) = 'EXIT' then
    begin
      ExitFunction;
      Exit;
    end;
        //    SendKeys(PChar(strKey), True);

          for i := 1 to Length(strKey) do
          begin                                      
            if strKey[i] = '^' then vkCtrl := True;
            if strKey[i] = '%' then vkShift := True;
            if strKey[i] = '@' then vkAlt := True;
            if strKey[i] = '#' then vkWin := True;
          end;
          

          if Pos('^', strKey)>0 then
            vkCtrl  := True;
          if Pos('%', strKey)>0 then
            vkShift := True;
          if Pos('@', strKey)>0 then
            vkAlt   := True;
          if Pos('#', strKey)>0 then
            vkWin   := True;

          vkKey := Trim(strKey);

          if vkCtrl then
            keybd_event(VK_CONTROL, VK_CONTROL, 0, 0);
          if vkShift then
            keybd_event(VK_SHIFT, VK_SHIFT, 0, 0);
          if vkAlt then
            keybd_event(VK_MENU, VK_MENU, 0, 0);   
          if vkWin then
            keybd_event(VK_LWIN, VK_MENU, 0, 0);

        //  keybd_event();

          if vkWin then
            keybd_event(VK_LWIN, VK_CONTROL, KEYEVENTF_KEYUP, 0);
          if vkAlt then
            keybd_event(VK_MENU, VK_MENU, KEYEVENTF_KEYUP, 0);
          if vkShift then
            keybd_event(VK_SHIFT, VK_SHIFT, KEYEVENTF_KEYUP, 0);
          if vkCtrl then
            keybd_event(VK_CONTROL, VK_CONTROL, KEYEVENTF_KEYUP, 0);
  end;
end;

{-------------------------------------------------------------------------------
  过程名:    StartApplication
  作者:      小冬[kendling]
  邮件:      kendling@sina.com
  主页:      http://www.MyvNet.com
  日期:      2005.02.26
  参数:      const appNum: string
  返回值:    无
  说明:      启动应用程序
-------------------------------------------------------------------------------}
procedure StartApplication(const appNum: string);
var
  strCmd: string;
  i, j: Integer;
begin
  j := StrToInt(appNum);
  for i := 0 to 9 do
  begin
    if (Programs[i].AppName <> '') and
      (Programs[i].AppPath <> '' ) then
      Dec(j);
    if j = 0 then
    begin
      SelectApp := TApplicationNum(i);
      Break;
    end;
  end;

  if FileExists(Programs[Ord(SelectApp)].AppPath) then
  begin
    ShellExecute(0, '', PChar(Programs[Ord(SelectApp)].AppPath), '', '', SW_SHOW);
    //让手机一直输入按键到计算机,直到计算机通知退出
//    strCmd := 'AT*EAID=13,2,"应用程序    ' + Programs[Ord(SelectApp)].AppName +
//      '  返回键可退出"';
    strCmd := 'AT*EAID=13,2,"应用程序 返回键可退出"';
    SendCmdToComPort(strCmd);
    CaptureKey(True);
  end else
  begin
    SendInfoToPhone(strFileNoExists);
  end;
end;

{-------------------------------------------------------------------------------
  过程名:    ShowHelp
  作者:      小冬[kendling]
  邮件:      kendling@sina.com
  主页:      http://www.MyvNet.com
  日期:      2005.02.25
  参数:      无
  返回值:    无
  说明:      显示帮助窗口
-------------------------------------------------------------------------------}
procedure ShowHelp;
begin
  if FHelp = nil then FHelp := TFHelp.Create(nil);
  FHelp.LoadHelp;
  FHelp.Visible := not FHelp.Visible;
end;

{-------------------------------------------------------------------------------
  过程名:    ShowPlayList
  作者:      小冬[kendling]
  邮件:      kendling@sina.com
  主页:      http://www.MyvNet.com
  日期:      2005.03.09
  参数:      无
  返回值:    无
  说明:      显示播放列表
-------------------------------------------------------------------------------}
procedure ShowPlayList(const iPage: Integer);
var
  i, iPos: Integer;
  strCmd: string;
begin
  //获取播放列表
  objPlayList.CommaText := objWinamp.GetPlayList;

  //计算页数
  iCountPages := objPlayList.Count div iPageSize;
  if objPlayList.Count mod iPageSize > 0 then
    Inc(iCountPages);

  //检测当前页
  iCurPage := iPage;
  if iCurPage < 0 then iCurPage := 1;
  if (iCurPage > iCountPages) or
    (iCurPage = 0) then iCurPage := iCountPages;
//  Dec(iCurPage);

  //显示播放列表
  for i:=0 to iPageSize-1 do
  begin
    iPos := (iCurPage - 1) * iPageSize + i;
    if iPos >= objPlayList.Count then
      Break;
    strCmd := strCmd + ',"' + objPlayList[iPos] + '"';
  end;
  strCmd := strCmd + ',"' + strWAPLMenu1 + '","' + strWAPLMenu2 + '","' +
    strWAPLMenu3 + '"';

  strCmd := 'AT*EASM="' + strMainMenu1 + '",1,1,' + IntToStr(i + 3) + strCmd;
  SendCmdToComPort(strCmd);

  bPlayList := True;
end;

{-------------------------------------------------------------------------------
  过程名:    ProcessPlayList
  作者:      小冬[kendling]
  邮件:      kendling@sina.com
  主页:      http://www.MyvNet.com
  日期:      2005.03.15
  参数:      const iMenu: Integer
  返回值:    无
  说明:      处理播放列表
-------------------------------------------------------------------------------}
procedure ProcessPlayList(const iMenu: Integer);
var
  iMenus: Integer;
//  i, iPos,
//    iPages: Integer;
//  strCmd: string;
begin
  //获取播放列表
  objPlayList.CommaText := objWinamp.GetPlayList;

  //计算页数
//  iCountPages := objPlayList.Count div iPageSize;
//  if objPlayList.Count mod iPageSize > 0 then
//    Inc(iCurPage);

  //处理最后页
//  iMenus := 0;
  if iCurPage = iCountPages then
    iMenus := objPlayList.Count mod iPageSize + 3
  else
    iMenus := 12;

  if iMenu = iMenus - 1 then
  begin //查找
    SendInfoToPhone('查找功能待实现', 3);
  end
  else begin
    if iMenu = iMenus - 2 then
      Dec(iCurPage);
    if iMenu = iMenus then
      Inc(iCurPage);
    ShowPlayList(iCurPage);
    if iMenu < iMenus - 2 then
      objWinamp.PlayIndex((iCurPage - 1) * iPageSize + iMenu);
  end;
end;

{-------------------------------------------------------------------------------
  过程名:    ExitFunction
  作者:      小冬[kendling]
  邮件:      kendling@sina.com
  主页:      http://www.MyvNet.com
  日期:      2005.02.25
  参数:      无
  返回值:    无
  说明:      退出
-------------------------------------------------------------------------------}
procedure ExitFunction;
begin
  case SelectMenu of
    pmsApplication:
      begin
        SendCmdToComPort('AT*EAID=0');
        SelectApp := appNone;
        CaptureKey(False);
        ShowApplicationMenu;
      end;
    pmsWinamp:
      ExitWinamp;
    pmsMouse:
      begin
        SendCmdToComPort('AT*EAID=0');
        SelectMenu := pmsNone;
        CaptureKey(False);
        ShowMainMenu;
      end;
  end;
end;

{-------------------------------------------------------------------------------
  过程名:    ExitApplication
  作者:      小冬[kendling]
  邮件:      kendling@sina.com
  主页:      http://www.MyvNet.com
  日期:      2005.02.25
  参数:      无
  返回值:    无
  说明:      退出应用程序
-------------------------------------------------------------------------------}
procedure ExitApplication;
begin
end;

{-------------------------------------------------------------------------------
  过程名:    ExitWinamp
  作者:      小冬[kendling]
  邮件:      kendling@sina.com
  主页:      http://www.MyvNet.com
  日期:      2005.02.25
  参数:      无
  返回值:    无
  说明:      退出Winamp
-------------------------------------------------------------------------------}
procedure ExitWinamp;
begin
end;

{-------------------------------------------------------------------------------
  过程名:    HaveApplications
  作者:      小冬[kendling]
  邮件:      kendling@sina.com
  主页:      http://www.MyvNet.com
  日期:      2005.02.18
  参数:      无
  返回值:    Boolean
  说明:      检测是否设置了程序
-------------------------------------------------------------------------------}
function HaveApplications: Boolean;
var
  i: Integer;
begin
  Result := False;
  for i:=0 to 9 do
  begin
    if (Programs[i].AppName <> '') and
      (Programs[i].AppPath <> '') then
    begin
      Result := True;
      Exit;
    end; //if
  end; //for
end;

⌨️ 快捷键说明

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