Thread: Unhandled exception error in VC++

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    1

    Unhandled exception error in VC++

    Hi

    I created a Win32 application but when i run it, i get an error and the program is terminated.

    When I run the program in debugger it gets into a file called WINMAIN.CPP and gives me an access violation error
    in funcion

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

    at "if (!pThread->InitInstance())" line.

    The error says "Unhandled exception in myfile.exe (MFC42D.DLL) : Access violation".

    What may be the problem? I am using VC++ 6.0.

    Thanks in advice....

  2. #2
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Did you instantiate your CWinApp object? It is obvious you are using AFX and I am guessing that you are writing it yourself as opposed to allowing VC to generate your classes. Is this correct?

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    pThread might be NULL.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging and unhandled exception
    By Overlord in forum Windows Programming
    Replies: 2
    Last Post: 07-25-2008, 06:39 AM
  2. Replies: 3
    Last Post: 11-11-2006, 06:46 PM
  3. unhandled exception error
    By trends in forum C++ Programming
    Replies: 4
    Last Post: 11-15-2002, 06:54 PM
  4. Unhandled exception
    By pdstatha in forum C++ Programming
    Replies: 1
    Last Post: 06-22-2002, 06:03 PM
  5. Unhandled Exception
    By StringQuartet13 in forum C++ Programming
    Replies: 1
    Last Post: 03-04-2002, 05:18 PM