Unhandled exception error in VC++

This is a discussion on Unhandled exception error in VC++ within the Windows Programming forums, part of the Platform Specific Boards category; Hi I created a Win32 application but when i run it, i get an error and the program is terminated. ...

  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,048
    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, 07: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, 07:03 PM
  5. Unhandled Exception
    By StringQuartet13 in forum C++ Programming
    Replies: 1
    Last Post: 03-04-2002, 05:18 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21