Link to home
Start Free TrialLog in
Avatar of arnold100
arnold100

asked on

Need a debug expert.

Hi All,
I am working in vc++ 6. I am getting an assert error in my program in debug mode as follows:

_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()
      { ASSERT(afxCurrentResourceHandle != NULL);
            return afxCurrentResourceHandle; }

I know this is a bool value returning true when it should be false but I have been over and over my code and I just can't find the problem. I have checked all the resources and find no problems. Can enyone point me in the right direction to solving this problem?

Thanks,
Arnold.
Avatar of Axter
Axter
Flag of United States of America image

Hi arnold100,
Post your code.....

David Maisonave :-)
Cheers!
Avatar of arnold100
arnold100

ASKER

Hi Axter,
I have no idea what part of my program is causing the problem. It's a resource problem but I can't figure out what resource is causing it. The program works fine in release mode but not in debug mode. The debugger points me to this code:

_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()
     { ASSERT(afxCurrentResourceHandle != NULL);
          return afxCurrentResourceHandle; }
 I am working in mfc. A resource is returning a true value when it should be returning a false value. I was hopeing someone here would have some idea of where to look for the problem.
ASKER CERTIFIED SOLUTION
Avatar of Axter
Axter
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Axter, I found it. something very simple.

I declared 2 variables in the wrong order:

HINSTANCE m_hInstance;
CString m_sCrpFile;

Because m_hInstance was before m_sCrpFile it caused an assert error on m_hInstance. After I stepped through the code a few more times I spotted it. Never had that happen before. Changed to:

CString m_sCrpFile;
HINSTANCE m_hInstance;

The assert error was gone.

Thank you for the help anyway,
Arnold.

Welcome.

Thanks for the points