debug unicode 可以编译通过
运行没有问题现在在debug下跟踪程序运行但是会出错,报出以下错误
Windows has triggered a breakpoint in myMdi.exe.This may be due to a corruption of the heap, and indicates a bug in myMdi.exe or any of the DLLs it has loaded.The output window may have more diagnostic information从程序入口跟踪
发现是pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW|FWS_ADDTOTITLE, NULL, NULL)这一句出错
继续跟踪的话发现在loadFrame函数中
LPCTSTR lpszClass = GetIconWndClass(dwDefaultStyle, nIDResource);
CString strTitle = m_strTitle;
if (!Create(lpszClass, strTitle, dwDefaultStyle, rectDefault,
  pParentWnd, ATL_MAKEINTRESOURCE(nIDResource), 0L, pContext))
{
return FALSE;   // will self destruct on failure normally
}
GetIconWndClass函数错误,返回的是空指针,导致下一步Create函数出错以前从来没有遇到过这样的错误,更疑惑的是为何编译出来的程序独立运行就没有问题
在vs2005下跟踪运行就会报错
请懂得这个的兄弟姐妹指教一下
谢谢了

解决方案 »

  1.   

    再跟踪到GetIconWndClass里面看哪里出问题。
      

  2.   


    GetIconWndClass 原型如下:
    LPCTSTR CFrameWnd::GetIconWndClass(DWORD dwDefaultStyle, UINT nIDResource)
    {
    ASSERT_VALID_IDR(nIDResource);
    HINSTANCE hInst = AfxFindResourceHandle(
    ATL_MAKEINTRESOURCE(nIDResource), ATL_RT_GROUP_ICON);
    HICON hIcon = ::LoadIcon(hInst, ATL_MAKEINTRESOURCE(nIDResource));
    if (hIcon != NULL)
    {
    CREATESTRUCT cs;
    memset(&cs, 0, sizeof(CREATESTRUCT));
    cs.style = dwDefaultStyle;
    PreCreateWindow(cs);
    // will fill lpszClassName with default WNDCLASS name
    // ignore instance handle from PreCreateWindow. WNDCLASS wndcls;
    if (cs.lpszClass != NULL &&
    AfxCtxGetClassInfo(AfxGetInstanceHandle(), cs.lpszClass, &wndcls) &&
    wndcls.hIcon != hIcon)
    {
    // register a very similar WNDCLASS
    return AfxRegisterWndClass(wndcls.style,
    wndcls.hCursor, wndcls.hbrBackground, hIcon);
    }
    }
    return NULL;        // just use the default
    }跟踪到
    if (cs.lpszClass != NULL &&
    AfxCtxGetClassInfo(AfxGetInstanceHandle(), cs.lpszClass, &wndcls) &&
    wndcls.hIcon != hIcon)
    {
    // register a very similar WNDCLASS
    return AfxRegisterWndClass(wndcls.style,
    wndcls.hCursor, wndcls.hbrBackground, hIcon);
    }
    }
    处发现在
    if (cs.lpszClass != NULL &&
    AfxCtxGetClassInfo(AfxGetInstanceHandle(), cs.lpszClass, &wndcls) &&
    wndcls.hIcon != hIcon)处出错
      

  3.   

    现在又出了新麻烦了
    原先能跟踪进去LoadFrame现在进不去了提示是:
    No symbols are loaded for any call stack frame. The source code cannot be displayed.头晕晕的

    快来救救我