What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

求助,我在vs2015里添加winform,编译后的dll在archebuddy中运行,窗体出现一下 就退了

qewrty123456

Member
Joined
Apr 13, 2016
Messages
34
Reaction score
0
我是模仿quest plugin 写的;
下面是ab错误提示:
System.Threading.ThreadAbortException: 正在中止线程。
在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.Run(Form mainForm)
在 autofffff.Host.RunForm()
源代码下
host.cs模块:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Xml;
using System.Reflection;
using System.Runtime.InteropServices;
using ArcheBuddy.Bot.Classes;
using autofffff.forms;

namespace autofffff
{
public class Host :Core
{
internal Main mainForm { get; set; }
private Thread formThread;


private void RunForm()
{
try
{
Application.Run(mainForm);
}
catch (Exception error)
{
Log(error.ToString());
}
}

public void PluginStop()
{


try
{
if (mainForm != null)
{
mainForm.Invoke(new Action(() => mainForm.Close()));
mainForm.Invoke(new Action(() => mainForm.Dispose()));
}
Application.Exit();
}
catch (Exception error)
{
Console.WriteLine(error.ToString());
}
try
{
//if (formThread.ThreadState == System.Threading.ThreadState.)
//{
formThread.Abort();
//formThread.Join();
//}
}
catch (Exception error)
{
Console.WriteLine("Error on stopping questing Thread!");
}
}




public void PluginRun()
{
try
{


mainForm = new Main();
mainForm.SetHost(this);


formThread = new Thread(RunForm);
formThread.IsBackground = true;
formThread.SetApartmentState(ApartmentState.STA);
formThread.Start();

}
catch (Exception error)
{
Log(error.ToString());
}

}
}
}

下面是winform代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace autofffff.forms
{
public partial class Main : Form
{
private Host host;
public Main()
{
InitializeComponent();
}

public void SetHost(Host host)
{
this.host = host;
}


private void Main_Load(object sender, EventArgs e)
{

}
}
}
 
你可以在ab的开发区反馈看看
目前archebuddy还没有中文区,我也没开发过ab的插件不太清楚,抱歉
 
Back
Top