Click to See Complete Forum and Search --> : AfxLockTempMaps ?


Alan Wright
June 11th, 1999, 06:21 AM
Could someone tell me what AfxLockTempMaps / AfxUnlockTempMaps functions are / do?

Eugene N
July 22nd, 1999, 07:48 AM
This function lock(unlock) temporary maps, which
created when you call CWnd::FromHandle for example.

So, when application go idle, temporary maps are deleted. To defend you temporary pointers from destroying you must call AfxLockTempMap, then, after you program will made need calculations call AfxUnlockTempMap to allow system to free
memory alocated to temporary objects. I think so,
but I can mistake and no test how it work. And don't know from where I've got this information.
I think the debugger tell me this :)

Example:

void CClass::OnHideMe( hWnd )
{
static CWnd* pWnd = CWnd::FromHandle( hWnd )
pWnd->ShowWindow( SW_HIDE );
// after quit this function temporary
// object, created by CWnd::FromHandle
// will be destroyed and next call to this
// function will fail
}





Eugene