我启动后报的错误是:Program '...........\xxx.exe' does not contain a static 'main' method suitable for an entry point. 我感觉启动的时候不是从我的main方法那个类启动,好像是从APP.AXML编译后的东西启动的。。
你的main方法怎么声明的阿 是这样吗: [STAThread] public static void Main() {}
是啊,除了少了个 PUBLIC。。
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows;namespace KeyEventTest { class Class1 { [STAThread] static void main() { Application app = new Application(); Window1 win1 = Window1.getWin(); app.Run(win1); } } }我完整的类是这样的, 你试验下,你可以运行么?
Application app = new Application();
app.Run(new YourWindow());
这样就可以了
{
Application app = new Application();
Window1 win1 = Window1.getWin();
app.Run(win1);
}我是这么写的
private static extern void SetState(ref object obj1, ref object obj2, ref object obj3);
调用时异常AccessViolationException,尝试读取或写入受保护的内存。
我感觉启动的时候不是从我的main方法那个类启动,好像是从APP.AXML编译后的东西启动的。。
是这样吗:
[STAThread]
public static void Main()
{}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;namespace KeyEventTest
{
class Class1
{
[STAThread]
static void main()
{
Application app = new Application();
Window1 win1 = Window1.getWin();
app.Run(win1);
}
}
}我完整的类是这样的,
你试验下,你可以运行么?
Main 的M 小写了。。