If you pass NULL for the first argument to GetSafeOwner, the function finds the parent window by calling AfxGetMainWnd(), which returns the m_pMainWnd from the application object.
The thing is, the DLL has its own application object that is separate from the main program's application object...