0

I have a legacy vb6 code that calls into c++ to display MFC dialog. Calling AfxGetResourceHandle to load the dll's resource onto the memory causes debug assert. Has anyone done this?

    HINSTANCE priorRes = AfxGetResourceHandle();

    if (m_MDCommonDll == NULL)
    {
        m_MDCommonDll = LoadLibrary("MyDll.dll");
    }

    AfxSetResourceHandle(m_MDCommonDll);

If this is not possible to do, is there a way to detect if the caller is from vb6 so that I can skip showing the UI?

Thanks

user156144
  • 2,215
  • 4
  • 29
  • 40

1 Answers1

1

AfxGetResourceHandle( ) can throw a debug assert if you mix release and debug build DLLs. Make sure your .exe and any .dlls it loads are all built as either release or debug.

osullivj
  • 341
  • 1
  • 5