#include <afxwin.h>class my_GUI: public CFrameWnd
{
public:
my_GUI()
{
Create(NULL, "Let's see if this is the window title");
}
};class my_App: public CWinApp
{
public:
BOOL InitInstance()
{
a_GUI = new my_GUI();
m_pMainWnd = a_GUI;
m_pMainWnd -> ShowWindow(1);
}
private:
my_GUI * a_GUI;
};

解决方案 »

  1.   

    改成下面这样,依旧报错 Access Violation:#include <afxwin.h>class my_GUI: public CFrameWnd
    {
    public:
    my_GUI()
    {
    Create(NULL, "Let us see if this is the window title");
    }
    };class my_App: public CWinApp
    {
    public:
    BOOL InitInstance()
    {
    a_GUI = new my_GUI();
    m_pMainWnd = a_GUI;
    m_pMainWnd -> ShowWindow(1);
    return 1;
    }
    private:
    my_GUI * a_GUI;
    };
      

  2.   

    a_GUI = new my_GUI();
    a_GUI->Create(...);//把Create放在这里试试
    m_pMainWnd = a_GUI;
    m_pMainWnd -> ShowWindow(1);
      

  3.   

    MFC……千万不要在构造/析构函数里处理与窗体句柄相关的操作
      

  4.   

    改成下面这样,依旧报错 Access Violation:
    看一下断点在哪里啊
      

  5.   

    嗬嗬,我把 Create 扔到 InitInstance 里面看看会怎么样。
      

  6.   

    调试一下就知道了。实在不行,把 code upload 到  bbs.aisnote.com ,我给你看看
      

  7.   

    自己写的SDK?有添加全局变量my_App theApp;???