Click to See Complete Forum and Search --> : Why does AfxGetThread() returns NULL


Dafkl
April 24th, 2007, 04:13 PM
Hey, I have this problem, it's just annoying.

I have a application where sometimes i get a Null from AfxGetThread, and this makes the whole thing crash.

I'd like to know under which circustances this function returns crash.

This application worked just fine until I migrate to the new MFC Compiler 8. I read that the function behavior changed and now the AfxGetApp is not called when the first call gets a null.

I tried this, but later on my application the panels are gotten as modaless intead of modal, and some other times when a new panel is created, it crash when the MFC calls AfxGetThread internally, (on the OnActivateTopLevel), I'll appreciate all help.thanks!!!