Link to home
Start Free TrialLog in
Avatar of dirtdart
dirtdart

asked on

MFC and Shell Assert errors

I am attempting to write a small dialog based MFC program that uses the SHGetValue to check a registry value.  However, whenever I include shlwapi.h and link with shlwapi.lib, the program crashes before it can even get started with the following error:

Debug Assertation Failed!

Program: D:\depmake.exe
File: afxwin1.inl
Line: 22

When debugging, I can't even step to the first line of the code before getting this error.  If I click the retry button to get to the source, it fails on the following line:

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

Does anyone know of a cure for this action?  I could really care less about using the SHGetValue function, but I'd hate to be excluded from using any shell functions simply because I'm using MFC (once again an indication of how poorly planned MFC is).

Thanks

Avatar of NT_Programmer
NT_Programmer

I would suggest trying the Reg type functions like:
RegOpenKeyEx
RegQueryValueEx

etc... That's the Win32 way to access registry values from _any_ Win32 program

The function SHGetValue is only for NT 5 (Windows 2000).
Avatar of dirtdart

ASKER

That is a good suggestion, and it's what I ended up doing with this program, but it doesn't solve the problem.  The program didn't crap out because of that function, it crapped out because I linked it with shlwapi.lib.
What OS are you running on?
ASKER CERTIFIED SOLUTION
Avatar of NT_Programmer
NT_Programmer

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
Sounds like a weiner to me.