aiqbal023 0 Newbie Poster

Hi Every one i m new to MFC programming i have written a program using VC++6.0
the code is

#include <afxwin.h>
class MFC_Tutorial_Window :public CFrameWnd
{
public:
    MFC_Tutorial_Window()
    {
         Create(NULL,"MFC Tutorial Part 1 CoderSource Window");
    }
};

class MyApp :public CWinApp
{
   MFC_Tutorial_Window *wnd; 
public:
   BOOL InitInstance()
   {
        wnd = new MFC_Tutorial_Window();
        m_pMainWnd = wnd;
        m_pMainWnd->ShowWindow(1);
        return 1;
     }
};

it compiles successfully but when i run this program it generates an Exception As Access Violation when i debug the program then found that exception is in

int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPTSTR lpCmdLine, int nCmdShow)

at this line

if (!pThread->InitInstance())

because pThread has null value please help