The following function works fine when the class "Util" was part of the MFC project I am writing.
Util *utilCTRL = new Util;
TRACE("*****DMFP Is Window %d\n",m_EnglishCTRL.m_hWnd);
TRACE("*****DMFP Not Window %d\n",m_EnglishCTRL.m_hWnd);
//Init Font Resources for the English Verse
//Init Font Resources for the Non-English Verse
I created an MFC extension DLL and transfered the Util class to it.
The Util class is declared in the "Util.h" class like this:
class AFX_EXT_CLASS Util : public CCmdTarget
I changed the #include statement in the CPP for the "Util.h" to point it to it's new location.
Also, in the Project Settings Link tab, I put the path to the new DLLs .Lib file there.
The function I am calling in the DLL is as follows:
void Util::ApplyFontToObj(CWnd* p_objToApply, CString strFontName, int intFontSize, int intWeight, bool bItalic, bool bUnderline)
CFont cfFontHolder; // structure for applying a font to an object
//Init Font Resources for the search for edit box
DEFAULT_PITCH | FF_SWISS, strFontName);
TRACE("*****AFTO Is Window %d\n", p_objToApply->m_hWnd);
TRACE("*****AFTO Not Window %d\n", p_objToApply->m_hWnd);
cfFontHolder.Detach(); //release DC
The ::IsWindows function returns true in the EXE but not in the DLL. In fact the m_hWnd is zero in the DLL.
Like I said, the Util::ApplyFontToObj function worked just fine when is was implemented in the EXE. When I implemented it into the DLL the CWnd* p_objToApply variable seems to have lost its refenence.
What is that?