USRDLL & VB
08-Jul-94 09:24:07
Sb: #29640-USRDLL & VB
Fm: Don Schmitt [MSFT] 74047,2146
To: Israel Burman 74214,1656
Hello Israel,
Sorry for not getting back to you sooner. There are several
options I wanted to explore on this question.
After looking into this issue and considering it a little
further I would recommend NOT using a message hook to insure
that the temporaries get deleted. MFC already provides a
way to destroy your temporaries safely and I believe it is not
necessary to burden the calling application with an extra hook
function processing every message (possibly unbeknownst to the
application).
The way to remove the temporaries is to use the AfxLockTempMaps
and AfxUnlockTempMaps functions. Through inspection (and experience)
it should become apparent when you are executing code in your DLL
functions which could create temporaries (MFC TechNote #3 discusses
temporary objects and when they are created). At the beginning of any
DLL function which might cause temporaries to be created simply
place a call to AfxLockTempMaps. At the end of the function place
a call to AfxUnlockTempMaps. See MFC TechNote #3 for details on
AfxLockTempMaps and AfxUnlockTempMaps.
Best Regards,
Don Schmitt
Microsoft Developer Support