Has anyone ever seen this? Please help I have been stuck for 2 days.

Yes, I call AFX_MANAGE_STATE(AfxGetStaticModuleState()); at the begining of the exported function.