mirror of
				https://github.com/huiyadanli/RevokeMsgPatcher.git
				synced 2025-11-04 05:46:08 +08:00 
			
		
		
		
	[+] 一个通用的微信多开工具
This commit is contained in:
		
							parent
							
								
									122c360fce
								
							
						
					
					
						commit
						16bfa32e0a
					
				| 
						 | 
					@ -33,14 +33,17 @@
 | 
				
			||||||
            this.btnChoosePath = new System.Windows.Forms.Button();
 | 
					            this.btnChoosePath = new System.Windows.Forms.Button();
 | 
				
			||||||
            this.label1 = new System.Windows.Forms.Label();
 | 
					            this.label1 = new System.Windows.Forms.Label();
 | 
				
			||||||
            this.label2 = new System.Windows.Forms.Label();
 | 
					            this.label2 = new System.Windows.Forms.Label();
 | 
				
			||||||
            this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
 | 
					            this.startNum = new System.Windows.Forms.NumericUpDown();
 | 
				
			||||||
            this.button1 = new System.Windows.Forms.Button();
 | 
					            this.btnStart = new System.Windows.Forms.Button();
 | 
				
			||||||
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
 | 
					            this.linkLabel1 = new System.Windows.Forms.LinkLabel();
 | 
				
			||||||
 | 
					            this.label3 = new System.Windows.Forms.Label();
 | 
				
			||||||
 | 
					            this.label4 = new System.Windows.Forms.Label();
 | 
				
			||||||
 | 
					            ((System.ComponentModel.ISupportInitialize)(this.startNum)).BeginInit();
 | 
				
			||||||
            this.SuspendLayout();
 | 
					            this.SuspendLayout();
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            // txtPath
 | 
					            // txtPath
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            this.txtPath.Location = new System.Drawing.Point(92, 48);
 | 
					            this.txtPath.Location = new System.Drawing.Point(86, 60);
 | 
				
			||||||
            this.txtPath.Name = "txtPath";
 | 
					            this.txtPath.Name = "txtPath";
 | 
				
			||||||
            this.txtPath.Size = new System.Drawing.Size(332, 21);
 | 
					            this.txtPath.Size = new System.Drawing.Size(332, 21);
 | 
				
			||||||
            this.txtPath.TabIndex = 7;
 | 
					            this.txtPath.TabIndex = 7;
 | 
				
			||||||
| 
						 | 
					@ -48,7 +51,7 @@
 | 
				
			||||||
            // lblPathTag
 | 
					            // lblPathTag
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            this.lblPathTag.AutoSize = true;
 | 
					            this.lblPathTag.AutoSize = true;
 | 
				
			||||||
            this.lblPathTag.Location = new System.Drawing.Point(21, 51);
 | 
					            this.lblPathTag.Location = new System.Drawing.Point(15, 63);
 | 
				
			||||||
            this.lblPathTag.Name = "lblPathTag";
 | 
					            this.lblPathTag.Name = "lblPathTag";
 | 
				
			||||||
            this.lblPathTag.Size = new System.Drawing.Size(65, 12);
 | 
					            this.lblPathTag.Size = new System.Drawing.Size(65, 12);
 | 
				
			||||||
            this.lblPathTag.TabIndex = 6;
 | 
					            this.lblPathTag.TabIndex = 6;
 | 
				
			||||||
| 
						 | 
					@ -56,17 +59,18 @@
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            // btnChoosePath
 | 
					            // btnChoosePath
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            this.btnChoosePath.Location = new System.Drawing.Point(430, 47);
 | 
					            this.btnChoosePath.Location = new System.Drawing.Point(424, 59);
 | 
				
			||||||
            this.btnChoosePath.Name = "btnChoosePath";
 | 
					            this.btnChoosePath.Name = "btnChoosePath";
 | 
				
			||||||
            this.btnChoosePath.Size = new System.Drawing.Size(50, 23);
 | 
					            this.btnChoosePath.Size = new System.Drawing.Size(36, 23);
 | 
				
			||||||
            this.btnChoosePath.TabIndex = 8;
 | 
					            this.btnChoosePath.TabIndex = 8;
 | 
				
			||||||
            this.btnChoosePath.Text = "...";
 | 
					            this.btnChoosePath.Text = "...";
 | 
				
			||||||
            this.btnChoosePath.UseVisualStyleBackColor = true;
 | 
					            this.btnChoosePath.UseVisualStyleBackColor = true;
 | 
				
			||||||
 | 
					            this.btnChoosePath.Click += new System.EventHandler(this.btnChoosePath_Click);
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            // label1
 | 
					            // label1
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            this.label1.AutoSize = true;
 | 
					            this.label1.AutoSize = true;
 | 
				
			||||||
            this.label1.Location = new System.Drawing.Point(106, 9);
 | 
					            this.label1.Location = new System.Drawing.Point(84, 151);
 | 
				
			||||||
            this.label1.Name = "label1";
 | 
					            this.label1.Name = "label1";
 | 
				
			||||||
            this.label1.Size = new System.Drawing.Size(293, 24);
 | 
					            this.label1.Size = new System.Drawing.Size(293, 24);
 | 
				
			||||||
            this.label1.TabIndex = 9;
 | 
					            this.label1.TabIndex = 9;
 | 
				
			||||||
| 
						 | 
					@ -75,45 +79,83 @@
 | 
				
			||||||
            // label2
 | 
					            // label2
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            this.label2.AutoSize = true;
 | 
					            this.label2.AutoSize = true;
 | 
				
			||||||
            this.label2.Location = new System.Drawing.Point(21, 77);
 | 
					            this.label2.Location = new System.Drawing.Point(15, 95);
 | 
				
			||||||
            this.label2.Name = "label2";
 | 
					            this.label2.Name = "label2";
 | 
				
			||||||
            this.label2.Size = new System.Drawing.Size(65, 12);
 | 
					            this.label2.Size = new System.Drawing.Size(65, 12);
 | 
				
			||||||
            this.label2.TabIndex = 11;
 | 
					            this.label2.TabIndex = 11;
 | 
				
			||||||
            this.label2.Text = "多开个数:";
 | 
					            this.label2.Text = "多开个数:";
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            // numericUpDown1
 | 
					            // startNum
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            this.numericUpDown1.Location = new System.Drawing.Point(92, 75);
 | 
					            this.startNum.Location = new System.Drawing.Point(86, 91);
 | 
				
			||||||
            this.numericUpDown1.Maximum = new decimal(new int[] {
 | 
					            this.startNum.Maximum = new decimal(new int[] {
 | 
				
			||||||
            1000,
 | 
					            1000,
 | 
				
			||||||
            0,
 | 
					            0,
 | 
				
			||||||
            0,
 | 
					            0,
 | 
				
			||||||
            0});
 | 
					            0});
 | 
				
			||||||
            this.numericUpDown1.Name = "numericUpDown1";
 | 
					            this.startNum.Minimum = new decimal(new int[] {
 | 
				
			||||||
            this.numericUpDown1.Size = new System.Drawing.Size(55, 21);
 | 
					            2,
 | 
				
			||||||
            this.numericUpDown1.TabIndex = 12;
 | 
					            0,
 | 
				
			||||||
            this.numericUpDown1.Value = new decimal(new int[] {
 | 
					            0,
 | 
				
			||||||
 | 
					            0});
 | 
				
			||||||
 | 
					            this.startNum.Name = "startNum";
 | 
				
			||||||
 | 
					            this.startNum.Size = new System.Drawing.Size(55, 21);
 | 
				
			||||||
 | 
					            this.startNum.TabIndex = 12;
 | 
				
			||||||
 | 
					            this.startNum.Value = new decimal(new int[] {
 | 
				
			||||||
            2,
 | 
					            2,
 | 
				
			||||||
            0,
 | 
					            0,
 | 
				
			||||||
            0,
 | 
					            0,
 | 
				
			||||||
            0});
 | 
					            0});
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            // button1
 | 
					            // btnStart
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            this.button1.Location = new System.Drawing.Point(211, 95);
 | 
					            this.btnStart.Location = new System.Drawing.Point(369, 91);
 | 
				
			||||||
            this.button1.Name = "button1";
 | 
					            this.btnStart.Name = "btnStart";
 | 
				
			||||||
            this.button1.Size = new System.Drawing.Size(108, 32);
 | 
					            this.btnStart.Size = new System.Drawing.Size(91, 23);
 | 
				
			||||||
            this.button1.TabIndex = 13;
 | 
					            this.btnStart.TabIndex = 13;
 | 
				
			||||||
            this.button1.Text = "点击启动!";
 | 
					            this.btnStart.Text = "点击启动!";
 | 
				
			||||||
            this.button1.UseVisualStyleBackColor = true;
 | 
					            this.btnStart.UseVisualStyleBackColor = true;
 | 
				
			||||||
 | 
					            this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
 | 
				
			||||||
 | 
					            // 
 | 
				
			||||||
 | 
					            // linkLabel1
 | 
				
			||||||
 | 
					            // 
 | 
				
			||||||
 | 
					            this.linkLabel1.AutoSize = true;
 | 
				
			||||||
 | 
					            this.linkLabel1.Location = new System.Drawing.Point(284, 95);
 | 
				
			||||||
 | 
					            this.linkLabel1.Name = "linkLabel1";
 | 
				
			||||||
 | 
					            this.linkLabel1.Size = new System.Drawing.Size(41, 12);
 | 
				
			||||||
 | 
					            this.linkLabel1.TabIndex = 15;
 | 
				
			||||||
 | 
					            this.linkLabel1.TabStop = true;
 | 
				
			||||||
 | 
					            this.linkLabel1.Text = "GitHub";
 | 
				
			||||||
 | 
					            this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
 | 
				
			||||||
 | 
					            // 
 | 
				
			||||||
 | 
					            // label3
 | 
				
			||||||
 | 
					            // 
 | 
				
			||||||
 | 
					            this.label3.AutoSize = true;
 | 
				
			||||||
 | 
					            this.label3.Location = new System.Drawing.Point(177, 95);
 | 
				
			||||||
 | 
					            this.label3.Name = "label3";
 | 
				
			||||||
 | 
					            this.label3.Size = new System.Drawing.Size(101, 12);
 | 
				
			||||||
 | 
					            this.label3.TabIndex = 14;
 | 
				
			||||||
 | 
					            this.label3.Text = "软件主页(开源):";
 | 
				
			||||||
 | 
					            // 
 | 
				
			||||||
 | 
					            // label4
 | 
				
			||||||
 | 
					            // 
 | 
				
			||||||
 | 
					            this.label4.AutoSize = true;
 | 
				
			||||||
 | 
					            this.label4.Location = new System.Drawing.Point(12, 9);
 | 
				
			||||||
 | 
					            this.label4.Name = "label4";
 | 
				
			||||||
 | 
					            this.label4.Size = new System.Drawing.Size(323, 36);
 | 
				
			||||||
 | 
					            this.label4.TabIndex = 16;
 | 
				
			||||||
 | 
					            this.label4.Text = "注意:\r\n1. 使用本程序多开前不能存在正在运行的微信进程。\r\n2. 多开的成功率取决于你的机器性能,不保证每次都能成功";
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            // FormMultiInstance
 | 
					            // FormMultiInstance
 | 
				
			||||||
            // 
 | 
					            // 
 | 
				
			||||||
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
 | 
					            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
 | 
				
			||||||
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
 | 
					            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
 | 
				
			||||||
            this.ClientSize = new System.Drawing.Size(513, 139);
 | 
					            this.ClientSize = new System.Drawing.Size(472, 133);
 | 
				
			||||||
            this.Controls.Add(this.button1);
 | 
					            this.Controls.Add(this.label4);
 | 
				
			||||||
            this.Controls.Add(this.numericUpDown1);
 | 
					            this.Controls.Add(this.linkLabel1);
 | 
				
			||||||
 | 
					            this.Controls.Add(this.label3);
 | 
				
			||||||
 | 
					            this.Controls.Add(this.btnStart);
 | 
				
			||||||
 | 
					            this.Controls.Add(this.startNum);
 | 
				
			||||||
            this.Controls.Add(this.label2);
 | 
					            this.Controls.Add(this.label2);
 | 
				
			||||||
            this.Controls.Add(this.label1);
 | 
					            this.Controls.Add(this.label1);
 | 
				
			||||||
            this.Controls.Add(this.txtPath);
 | 
					            this.Controls.Add(this.txtPath);
 | 
				
			||||||
| 
						 | 
					@ -121,7 +163,7 @@
 | 
				
			||||||
            this.Controls.Add(this.btnChoosePath);
 | 
					            this.Controls.Add(this.btnChoosePath);
 | 
				
			||||||
            this.Name = "FormMultiInstance";
 | 
					            this.Name = "FormMultiInstance";
 | 
				
			||||||
            this.Text = "微信多开小工具";
 | 
					            this.Text = "微信多开小工具";
 | 
				
			||||||
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
 | 
					            ((System.ComponentModel.ISupportInitialize)(this.startNum)).EndInit();
 | 
				
			||||||
            this.ResumeLayout(false);
 | 
					            this.ResumeLayout(false);
 | 
				
			||||||
            this.PerformLayout();
 | 
					            this.PerformLayout();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -134,8 +176,11 @@
 | 
				
			||||||
        private System.Windows.Forms.Button btnChoosePath;
 | 
					        private System.Windows.Forms.Button btnChoosePath;
 | 
				
			||||||
        private System.Windows.Forms.Label label1;
 | 
					        private System.Windows.Forms.Label label1;
 | 
				
			||||||
        private System.Windows.Forms.Label label2;
 | 
					        private System.Windows.Forms.Label label2;
 | 
				
			||||||
        private System.Windows.Forms.NumericUpDown numericUpDown1;
 | 
					        private System.Windows.Forms.NumericUpDown startNum;
 | 
				
			||||||
        private System.Windows.Forms.Button button1;
 | 
					        private System.Windows.Forms.Button btnStart;
 | 
				
			||||||
 | 
					        private System.Windows.Forms.LinkLabel linkLabel1;
 | 
				
			||||||
 | 
					        private System.Windows.Forms.Label label3;
 | 
				
			||||||
 | 
					        private System.Windows.Forms.Label label4;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,11 @@
 | 
				
			||||||
using System;
 | 
					using Microsoft.Win32;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.ComponentModel;
 | 
					using System.ComponentModel;
 | 
				
			||||||
using System.Data;
 | 
					using System.Data;
 | 
				
			||||||
 | 
					using System.Diagnostics;
 | 
				
			||||||
using System.Drawing;
 | 
					using System.Drawing;
 | 
				
			||||||
 | 
					using System.IO;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
using System.Text;
 | 
					using System.Text;
 | 
				
			||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
| 
						 | 
					@ -15,6 +18,94 @@ namespace RevokeMsgPatcher.MultiInstance
 | 
				
			||||||
        public FormMultiInstance()
 | 
					        public FormMultiInstance()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            InitializeComponent();
 | 
					            InitializeComponent();
 | 
				
			||||||
 | 
					            string installFolder = FindInstallPathFromRegistry("Wechat");
 | 
				
			||||||
 | 
					            if (!string.IsNullOrEmpty(installFolder))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                string wechatPath = Path.Combine(installFolder, "WeChat.exe");
 | 
				
			||||||
 | 
					                if (File.Exists(wechatPath))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    txtPath.Text = wechatPath;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private void btnChoosePath_Click(object sender, EventArgs e)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            OpenFileDialog dialog = new OpenFileDialog
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Multiselect = false,
 | 
				
			||||||
 | 
					                Title = "请选择微信启动主程序",
 | 
				
			||||||
 | 
					                Filter = "微信主程序|WeChat.exe"
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					            if (dialog.ShowDialog() == DialogResult.OK)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                txtPath.Text = dialog.FileName;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private void btnStart_Click(object sender, EventArgs e)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (File.Exists(txtPath.Text))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                // 检测微信进程是否存在
 | 
				
			||||||
 | 
					                Process[] ps = Process.GetProcessesByName("WeChat");
 | 
				
			||||||
 | 
					                if (ps.Length > 0)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    DialogResult result = MessageBox.Show("当前存在运行中的微信进程,请先关闭当前微信才能使用该功能。点击【确定】强制关闭当前所有微信进程并进行多开,点击【取消】不做任何处理。", "当前存在运行中的微信进程", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
 | 
				
			||||||
 | 
					                    if (result == DialogResult.OK)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        foreach (Process p in ps)
 | 
				
			||||||
 | 
					                            p.Kill();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        return;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                // 启动多个实例
 | 
				
			||||||
 | 
					                for (int i = 0; i < startNum.Value; i++)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    Process.Start(txtPath.Text);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Process.Start("https://github.com/huiyadanli/RevokeMsgPatcher");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 从注册表中寻找安装路径
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="uninstallKeyName">
 | 
				
			||||||
 | 
					        /// 安装信息的注册表键名
 | 
				
			||||||
 | 
					        /// 微信:WeChat
 | 
				
			||||||
 | 
					        /// QQ:{052CFB79-9D62-42E3-8A15-DE66C2C97C3E} 
 | 
				
			||||||
 | 
					        /// TIM:TIM
 | 
				
			||||||
 | 
					        /// </param>
 | 
				
			||||||
 | 
					        /// <returns>安装路径</returns>
 | 
				
			||||||
 | 
					        public static string FindInstallPathFromRegistry(string uninstallKeyName)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                RegistryKey key = Registry.LocalMachine.OpenSubKey($@"Software\Microsoft\Windows\CurrentVersion\Uninstall\{uninstallKeyName}");
 | 
				
			||||||
 | 
					                if (key == null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    return null;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                object installLocation = key.GetValue("InstallLocation");
 | 
				
			||||||
 | 
					                key.Close();
 | 
				
			||||||
 | 
					                if (installLocation != null && !string.IsNullOrEmpty(installLocation.ToString()))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    return installLocation.ToString();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception e)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Console.WriteLine(e.Message);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return null;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user