激活微信修改

This commit is contained in:
老道 2022-11-10 20:11:42 +08:00
parent 08a8297e0c
commit aa7b865624
2 changed files with 11 additions and 5 deletions

View File

@ -42,7 +42,7 @@ namespace PCRobot
try try
{ {
WeChatActivateHelper.Init(TimeSpan.FromMinutes(20)); WeChatActivateHelper.Init(TimeSpan.FromMinutes(40));
} }
catch (Exception exception) catch (Exception exception)
{ } { }

View File

@ -115,7 +115,7 @@ namespace WechatHelper
if (isIconic) if (isIconic)
{ {
ShowWindow(handle, 1); ShowWindow(handle, 1);
Thread.Sleep(new Random(Guid.NewGuid().GetHashCode()).Next(8000, 10000)); Thread.Sleep(1000);
} }
var thisHandel = Process.GetCurrentProcess().MainWindowHandle; var thisHandel = Process.GetCurrentProcess().MainWindowHandle;
@ -153,10 +153,16 @@ namespace WechatHelper
}, null); }, null);
//如果微信最小化了,重新让他最小化 //如果微信最小化了,重新让他最小化
if (!isIconic) continue;
Thread.Sleep(new Random(Guid.NewGuid().GetHashCode()).Next(40000, 60000)); if (isIconic)
{
Thread.Sleep(1000);
ShowWindow(handle, 2); ShowWindow(handle, 2);
}
//休眠
Thread.Sleep(new Random(Guid.NewGuid().GetHashCode()).Next(40000, 60000));
} while (true); } while (true);
} }
catch (Exception e) catch (Exception e)
@ -178,7 +184,7 @@ namespace WechatHelper
{ {
try try
{ {
Thread.Sleep(1000); Thread.Sleep(5000);
var rstHandlePtr = FindWindowExA(IntPtr.Zero, handle, className, windowName); var rstHandlePtr = FindWindowExA(IntPtr.Zero, handle, className, windowName);
if (handle == IntPtr.Zero) break; if (handle == IntPtr.Zero) break;
if (handleList.Contains(handle)) break; if (handleList.Contains(handle)) break;