如题。。

解决方案 »

  1.   

    在main方法中这样写:
    Application app = new Application();
    app.Run(new YourWindow());
    这样就可以了
      

  2.   

    static void main()
            {
                Application app = new Application();
                Window1 win1 = Window1.getWin();
                app.Run(win1);
            }我是这么写的
      

  3.   

    声明如下:
    private static extern void SetState(ref object obj1, ref object obj2, ref object obj3);
    调用时异常AccessViolationException,尝试读取或写入受保护的内存。
      

  4.   

    汗。。写错、、obj1,2,3分别是什么?
      

  5.   

    我启动后报的错误是:Program '...........\xxx.exe' does not contain a static 'main' method suitable for an entry point.
    我感觉启动的时候不是从我的main方法那个类启动,好像是从APP.AXML编译后的东西启动的。。
      

  6.   

    你的main方法怎么声明的阿
    是这样吗:
    [STAThread]
    public static void Main()
    {}
      

  7.   

    是啊,除了少了个 PUBLIC。。
      

  8.   

    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);
            }
        }
    }我完整的类是这样的,
    你试验下,你可以运行么?
      

  9.   

    汗发了下发现错误了。。
    Main 的M 小写了。。