vs 挤房间工具

补上使用方法:
  1. 打开vs
  2. 选中房间,按alt+f1,开始挤房间
  3. 进入房间以后,按alt+f2停止
目前的bug:
  1. 有时候会弹出退出vs的窗口,这个时候请手动选择
  2. 必须放在桌面看的到的地方,不用置顶
下次版本预计加入功能:
  1. 修正bug1
  2. 添加个性化挤房间模式:顺序挤房间(并不针对单一房间)
  3. 自动升级
.h文件
  1. //---------------------------------------------------------------------------
  2. #ifndef Unit1H
  3. #define Unit1H
  4. //---------------------------------------------------------------------------
  5. #include <Classes.hpp>
  6. #include <Controls.hpp>
  7. #include <StdCtrls.hpp>
  8. #include <Forms.hpp>
  9. #include <ExtCtrls.hpp>
  10. #include "trayicon.h"
  11. #include <ImgList.hpp>
  12. #include <Menus.hpp>
  13. //---------------------------------------------------------------------------
  14. class TForm1 : public TForm
  15. {
  16. __published:    // IDE-managed Components
  17.     TTimer *Timer1;
  18.     TTrayIcon *TrayIcon1;
  19.     TPopupMenu *PopupMenu1;
  20.     TImageList *ImageList1;
  21.     TMenuItem *N1;
  22.     TMenuItem *ALTF21;
  23.     TMenuItem *N2;
  24.     void __fastcall Button1Click(TObject *Sender);
  25.     void __fastcall Timer1Timer(TObject *Sender);
  26.     void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
  27.     void __fastcall N1Click(TObject *Sender);
  28.     void __fastcall ALTF21Click(TObject *Sender);
  29.     void __fastcall FormShow(TObject *Sender);
  30.     void __fastcall N2Click(TObject *Sender);
  31. private:    // User declarations
  32.     int StartHotKeyId;
  33.     int StopHotKeyId;
  34.     TPoint pt;
  35.     void __fastcall HotKeyDown(TMessage &Msg);
  36. public:     // User declarations
  37.     __fastcall TForm1(TComponent* Owner);
  38. BEGIN_MESSAGE_MAP
  39.     VCL_MESSAGE_HANDLER(WM_HOTKEY, TMessage, HotKeyDown);
  40. END_MESSAGE_MAP(TForm);
  41. };
  42. //---------------------------------------------------------------------------
  43. extern PACKAGE TForm1 *Form1;
  44. //---------------------------------------------------------------------------
  45. #endif
 .c文件
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Unit1.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma link "trayicon"
  8. #pragma resource "*.dfm"
  9. TForm1 *Form1;
  10. //---------------------------------------------------------------------------
  11. __fastcall TForm1::TForm1(TComponent* Owner)
  12.     : TForm(Owner)
  13. {
  14.     StartHotKeyId = GlobalAddAtom("StartVSLoader")-0xC000; 
  15.     StopHotKeyId = GlobalAddAtom("StopVSLoader")-0xC000;
  16.     RegisterHotKey(Handle , StartHotKeyId , MOD_ALT,VK_F1);
  17.     RegisterHotKey(Handle , StopHotKeyId  , MOD_ALT,VK_F2);
  18.     Application->ShowMainForm = false;
  19. }
  20. //---------------------------------------------------------------------------
  21. void __fastcall TForm1::HotKeyDown(TMessage &Msg)
  22. {
  23.     if( (Msg.LParamLo == MOD_ALT)&& (Msg.LParamHi == VK_F1) ){
  24.         Timer1->Enabled = true;
  25.         TrayIcon1->Animate = true;
  26.         GetCursorPos(&pt);
  27.     }
  28.     if( (Msg.LParamLo == MOD_ALT)&& (Msg.LParamHi == VK_F2) ){
  29.         Timer1->Enabled = false;
  30.         TrayIcon1->Animate = false;
  31.     }
  32. }
  33. //---------------------------------------------------------------------------
  34. void __fastcall TForm1::Button1Click(TObject *Sender)
  35. {
  36.     //HWND listview =   FindWindow(NULL, "VS竞技游戏平台");//
  37.     //TPoint pt;
  38.     //GetCursorPos(&pt);
  39.     Timer1->Enabled = true;
  40. }
  41. //---------------------------------------------------------------------------
  42. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  43. {
  44.     Timer1->Enabled = false;
  45.     TPoint tmp;
  46.     GetCursorPos(&tmp);
  47.     SetCursorPos(pt.x,pt.y);
  48.     HWND win = NULL;
  49.     win =FindWindow(NULL, "VS竞技游戏平台");
  50.     if(win){
  51.         keybd_event(VK_ESCAPE ,0,KEYEVENTF_EXTENDEDKEY   |   0,0   );
  52.         keybd_event(VK_ESCAPE ,0,KEYEVENTF_EXTENDEDKEY   |   KEYEVENTF_KEYUP,0);   
  53.     }
  54.     win =FindWindow(NULL, "VSClient");
  55.     if(win){
  56.         keybd_event(VK_ESCAPE ,0,KEYEVENTF_EXTENDEDKEY   |   0,0   );
  57.         keybd_event(VK_ESCAPE ,0,KEYEVENTF_EXTENDEDKEY   |   KEYEVENTF_KEYUP,0);   
  58.     }
  59.     if(win == NULL){
  60.         mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
  61.         mouse_event(MOUSEEVENTF_LEFTUP  ,0,0,0,0);
  62. //bug001::现在vs版本对应
    •         mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
    •         mouse_event(MOUSEEVENTF_LEFTUP  ,0,0,0,0);
  63. //bug001::end
  64.     }
  65.     SetCursorPos(tmp.x, tmp.y);
  66.     Timer1->Enabled = true;
  67. }
  68. //---------------------------------------------------------------------------
  69. void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
  70. {
  71.     UnregisterHotKey(Handle , StartHotKeyId);
  72.     UnregisterHotKey(Handle , StopHotKeyId);
  73. }
  74. //---------------------------------------------------------------------------
  75. void __fastcall TForm1::N1Click(TObject *Sender)
  76. {
  77.     Timer1->Enabled = true;
  78.     TrayIcon1->Animate = true;
  79. }
  80. //---------------------------------------------------------------------------
  81. void __fastcall TForm1::ALTF21Click(TObject *Sender)
  82. {
  83.     Timer1->Enabled = false;
  84.     TrayIcon1->Animate = false;
  85. }
  86. //---------------------------------------------------------------------------
  87. void __fastcall TForm1::FormShow(TObject *Sender)
  88. {
  89.     TrayIcon1->Minimize();
  90. }
  91. //---------------------------------------------------------------------------
  92. void __fastcall TForm1::N2Click(TObject *Sender)
  93. {
  94.     Close();
  95. }
  96. //---------------------------------------------------------------------------

代码和可执行文件下载地址:http://download.csdn.net/source/567156

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值