FIX: AFX_IDC_MAGNIFY Cursor Fails to Load from AFXDLL

ID: Q113532

1.00 WINDOWS kbprg kbfixlist kbbuglist

The information in this article applies to:

SYMPTOMS

When using the File Print Preview capabilities of the Microsoft Foundation Classes (MFC), the mouse cursor disappears when dragged over a view when the application is in Print Preview mode. This behavior occurs only when the AFX_IDC_MAGNIFY cursor resource is moved from the application to an extension (_AFXDLL) DLL.

CAUSE

The problem occurs in the CPreviewView::OnSetCursor() function. Line 904 of the VIEWPREV.CPP file, below

   m_hMagnifyCursor = ::LoadCursor(AfxGetInstanceHandle(),
                                   MAKEINTRESOURCE(AFX_IDC_MAGNIFY));

should be

   m_hMagnifyCursor = ::LoadCursor(AfxGetResourceHandle(),
                                   MAKEINTRESOURCE(AFX_IDC_MAGNIFY));

STATUS

Microsoft has confirmed this to be a problem in the Microsoft Foundation Classes for Windows version 2.0. This problem was corrected in the Microsoft Foundation Classes version 2.5.

MORE INFORMATION

AfxGetInstanceHandle() always returns the HINSTANCE of the application. AfxGetResourceHandle() first checks the application for the resource; if it isn't found, AfxGetResourceHandle() walks through each of the extension dynamic-link libraries (DLLs) to find the resource. For additional information concerning AfxGetResourceHandle(), please consult the Microsoft Foundation Classes Technical Note #33.

Additional reference words: 1.00 2.00 magnify print preview technote tech note KBCategory: kbprg kbfixlist kbbuglist KBSubcategory: MfcDLL

Keywords          : kb16bitonly kbDLL kbMFC kbVC kbbuglist kbfixlist
Version           : 1.00
Platform          : WINDOWS
Solution Type     : kbfix

Last Reviewed: September 21, 1997